Reputation: 1055
Included is an object array being used in an ng-repeat call
And here is the error
For the love of me I cannot seem to get why angular is treating these as duplicates.
Any help is much appreciated.
Upvotes: 0
Views: 36
Reputation: 91515
Angular is telling you it doesn't know how to differentiate the items in your list, so you must tell it which field in your objects make it unique. Click here for more documentation on track by
To do this you need to add track by
to your ng-repeat
statement. You can specify any field on the object such as yid
.
<div ng-repeat="item in items track by item.yid">
...
</div>
However, if you didn't have any fields that tracked uniqueness, you can also track by the index of the item in the list using $index
.
<div ng-repeat="item in items track by $index">
...
</div>
Upvotes: 2