@shreyasgombi wrote:
Hi guys,
A newbie here. Let's say I have an object like this in a controller,In Controller :
var $scope.orders = [{"id": "1", "code":"AAA", "type":"orders", "product":"Cookies"},
{"id": "2", "code":"AAA", "type":"orders", "product":"Cream"},
{"id": "3", "code":"BBB", "type":"orders", "product":"Pie"},
{"id": "4", "code":"AAA", "type":"orders", "product":"Nutella"}]In HTML View :
Can I use two ng-repeat on this $scope.orders like this,
<div ng-repeat="order in orders" ng-if="order.code=='AAA'">
Order Type : {{order.type}}, Product : {{order.product}}
</div>
<div ng-repeat="order in orders" ng-if="order.code=='BBB'">
Order Type : {{order.type}}, Product : {{order.product}}
</div>I am getting an output though I see the orders with code BBB is also showing in the list of AAA, and sometimes AAA orders don't show up. Is this a valid way to do? Any input would be great.
Posts: 1
Participants: 1