I have a json object with several properties in it, including a list of another type of object. Then I associate the main object with the template using the tmpl plugin, and I have {{each}} for the list. Inside each of them I want to get a property of the original object.
Example:
new PageItem( 'Josie',//Name 816,//ItemID 0.0000,//Price 0,//Quantity -1,//DiscountPrice 'Adopt this bilby!',//Content ko.observableArray([ //Mods new ModItem( '1. Bronze $50', //Name 812, //ItemID 50.0000, //Price -1//DiscountPrice ), new ModItem( '2. Silver $100', //Name 813, //ItemID 100.0000, //Price -1//DiscountPrice ) )
Template:
{{each Mods}} ${Name} - ${parentname?} {{/each}}
This is probably a little more complicated if the objects have the same property names ...
source share