With reference to below question asked in stackoverflow
Display clicked item
I have modified the fiddle created by john papa. Here is my updated fiddle
If you click on the New button you will see the following error in your browser javascript console:
Uncaught ReferenceError: item is not defined
Because you don't have item
in your method. In your case the item
should be the newly created Thing
so store it in a variable which you can name item
and it will work fine.
this.NewDetail = function(){
var item = new Thing(4, "Thing 4", self.model.CurrentDisplayThing);
self.model.Things.push(item);
self.model.CurrentDisplayThing(item);
};
Here is an updated JSFIddle.