AngularJS 使用ng-repeat报错
[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq
ng-repeat报错
<div ng-init="words = ['高校','高校','高校']" ng-repeat="word in words"> {{word}} </div>
[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys
发现是因为相同的内容重复引起,解决方案
<div ng-init="words = ['高校','高校','高校']" ng-repeat="word in words track by $index"> {{word}} </div>
在ng-repeat后面加上
track by $index
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
到此这篇关于AngularJS 使用ng-repeat报错 [ngRepeat:dupes]就介绍到这了。若是时间允许,自己还会在哪些地方做得更好等等,只有坚持这样,你才可能有快速的进步。更多相关AngularJS 使用ng-repeat报错 [ngRepeat:dupes]内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!