Can I use ng-repeat twice on the same object $scope variable?


#1

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,

`


Order Type : {{order.type}}, Product : {{order.product}}
`

`


Order Type : {{order.type}}, Product : {{order.product}}
`

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. :smile: