数码资讯
AngularJS 使用ng-repeat报错 [ngRepeat:dupes]
AngularJS 使用ng-repeat报错 [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq ng-repeat报错
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
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
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。