Reputation:
Maybe I'm thinking about this the wrong way but let me explain:
I have 16 products and multiple orders. I know that these will be the only 16 products I 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 are structured like this:
{"date":"5834755","product1":564,"product2":456,etc...
I could write it like this:
<div ng-repeat="order in orders">
<span>{{order.product1}}</span>
<span>{{order.product2}}</span>
etc...
</div>
I am probably overthinking and trying to over simplify my template... What do you think?
Upvotes: 0
Views: 188
Reputation: 891
I have used a similar notation to print the data of an object and I recommend you do the following:
<div ng-repeat="order in orders">
<span ng-repeat="product in products">{{order[product]}}</span>
</div>
This should work.
Upvotes: 1