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报错
<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
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
相关文章
Angular2.0/4.0 使用Echarts图表的示例代码
本篇文章主要介绍了Angular2.0/4.0 使用Echarts的示例代码,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2017-12-12Angular ng-repeat遍历渲染完页面后执行其他操作详细介绍
这篇文章主要介绍了Angular ng-repeat遍历渲染完页面后执行其他操作详细介绍的相关资料,需要的朋友可以参考下2016-12-12详解angularjs结合pagination插件实现分页功能
本篇文章主要介绍了详解angularjs结合pagination插件实现分页功能,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。2017-02-02
最新评论