Error: [ngRepeat:dupes] what does this mean?

后端 未结 2 1613
囚心锁ツ
囚心锁ツ 2020-12-17 09:08

repeat directive outputing wine records from an api. I have a factory function to serve up the wine API which is then accessed in my controller

app.factory(         


        
相关标签:
2条回答
  • 2020-12-17 09:29

    It is true that AngularJS uses keys to associate DOM nodes with items. So, you can solve by adding "track by $index".

    It will look like this

    ng-repeat="wine in wines track by $index"

    0 讨论(0)
  • 2020-12-17 09:48

    Occurs if there are duplicate keys in an ngRepeat expression. Duplicate keys are banned because AngularJS uses keys to associate DOM nodes with items.

    This means that $scope.wines have some values which are duplicate.

    You can also refer this post : Angular ng-repeat Error "Duplicates in a repeater are not allowed."

    0 讨论(0)
提交回复
热议问题