Reputation: 803
I am developing the system for Hotel POS solution. I want to fetch all the current orders and show the table number of orders only once.
But the table number is repeating for all the orders I have written following code :
<span ng-repeat='orders in allCurrentOrder' ng-if='orders.custId==ctrl.person" + scope.divId + ".selected.cust_id && orders.orderType=="+scope.orderType+"'>Table No. : {{orders.tableNumber}}</span>
and I want output as :
Table No. : 9
but I am getting
Table No. : 9Table No. : 9Table No. : 9Table No. : 9Table No. : 9Table No. : 9Table No. : 9
how can I solve this problem?
Upvotes: 1
Views: 239
Reputation: 117
<span ng-repeat='orders in allCurrentOrder track by $index' ng-if='orders.custId==ctrl.person" + scope.divId + ".selected.cust_id && orders.orderType=="+scope.orderType+"'>Table No. : {{orders.tableNumber}}</span>
Upvotes: 0
Reputation: 58
Use track by
:
ng-repeat='orders in allCurrentOrder track by orders.tableNumber'
Upvotes: 4