javascript - nested/dynamic handlebars in angular -
maybe i'm thinking wrong way let me explain:
i have 16 products , multiple orders. know these 16 products ever have. (the following code doesn't work)
<div ng-repeat="order in orders"> <span ng-repeat="product in products">{{order.{{product}}}}</span> </div>
my orders structured this:
{"date":"5834755","product1":564,"product2":456,etc...
i write this:
<div ng-repeat="order in orders"> <span>{{order.product1}}</span> <span>{{order.product2}}</span> etc... </div>
i overthinking , trying on simplify template... think?
i have used similar notation print data of object , recommend following:
<div ng-repeat="order in orders"> <span ng-repeat="product in products">{{order[product]}}</span> </div>
this should work.
Comments
Post a Comment