首页 > 其他 > 详细

[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq

时间:2014-07-31 13:34:04      阅读:402      评论:0      收藏:0      [点我收藏+]

angularjs 使用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


[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq,布布扣,bubuko.com

[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq

原文:http://blog.csdn.net/zml6308/article/details/38312347

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!