源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

AngularJS 使用ng-repeat报错 [ngRepeat:dupes]

  • 时间:2022-01-15 03:42 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:AngularJS 使用ng-repeat报错 [ngRepeat:dupes]
[b]AngularJS 使用ng-repeat报错[/b]  [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 
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部