Angular报错:[ngRepeat:dupes] Duplicates in a repeater are not allowed.

Angular报错:[ngRepeat:dupes] Duplicates in a repeater are not allowed._第1张图片
报错.png

一般出错的原因是ng-repeat中的数据有重复,

// 数据中有重复数据
data = ['1', '1', '2']

解决办法: 加上track by $index 或者数据中自带的ID也可以

ng-repeat="i in data track by $index"

你可能感兴趣的:(Angular报错:[ngRepeat:dupes] Duplicates in a repeater are not allowed.)