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的更多相关文章

  1. [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use &#39;track by&#39; expression to specify uniq

    angularjs 使用ng-repeat报错 <div ng-init="words = ['高校','高校','高校']" ng-repeat="word in ...

  2. Angular项目 Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed.报错

    在angular的项目里,一不小心就会出现这个错误[ngRepeat:dupes] ,这个问题是因为内容有重复引起的解决起来挺简单 在对应的ng-repeat指令中增加track by $index, ...

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

    错误原因在于出现相同内容. 原写为: <li ng-repeat="log in logs" scroll-down> {{log}}</li> 改写为: ...

  4. ng-repeat出现环路输出Duplicates in a repeater are not allowed. Use &#39;track by&#39; expression to specify unique

    采用ng-repeat循环发生错误时,如下面的输出对象: Duplicates in a repeater are not allowed. Use 'track by' expression to ...

  5. [整理]Error: [ngRepeat:dupes]的解决方法

    sdfsadf <div class="pageNum middle PT10"> <a href="javascript:void(0);" ...

  6. 【angularjs基础】ng-repeat嵌套循环报错angular.min.js:89 Error: [ngRepeat:dupes]

    再写嵌套循环的时候,提示一个错误 angular.min.js: Error: [ngRepeat:dupes] 代码如下 <table class="GridViewTable mt ...

  7. ng-model 数据不更新 及 ng-repeat【ngRepeat:dupes】错误

    一.ng-include 引入的文件中 ,ng-model 数据不更新 例如, $scope.username = “Jones”  .此时,在 ng-include 引入的文件中,直接使用 ng-m ...

  8. Angular JS ng-repeat 报错 Error: [ngRepeat:dupes]

    ng-repeat常用情况: <div class="form-group" ng-repeat="item in items"></div& ...

  9. AngularJS ng-repeat使用及注意事项

    用法:ng-repeat="extension"; extension(表达式) 定义了如何循环集合. 表达式实例规则: 1. x in records 2. (key,value ...

随机推荐

  1. 获取客户端ip地址

    新浪的IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js 新浪多地域测试方法:http://int.dpool. ...

  2. mysql 表被锁处理方案

    1. 查询锁表信息 当前运行的所有事务 select * from information_schema.innodb_trx 当前出现的锁 select * from information_sch ...

  3. 阅读 图解HTTP ,读书笔记

    阅读它的目的只有一个:就是想了解客户端与服务端的通信是怎么实现的?    数据的存储是怎么实现的?     数据流通过程中遇到什么问题.返回什么状态.该怎么解决? 网络基础 TCP / IP 通常使用 ...

  4. 怎么解决mysql不允许远程连接的错误

    最近使用Navicat for MySQl访问远程mysql数据库,出现报错,显示"1130 - Host'xxx.xxx.xxx.xxx' is not allowed to connec ...

  5. js window.open 打开新窗体 参数设置

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. 解决PHP生成UTF-8编码的CSV文件用Excel打开乱码的问题

    在要输出的内容前先输出"\xEF\xBB\xBF", eg:要输出的内容保存在$content里$content = "\xEF\xBB\xBF".$conte ...

  7. 【C++实现python字符串函数库】strip、lstrip、rstrip方法

    [C++实现python字符串函数库]strip.lstrip.rstrip方法 这三个方法用于删除字符串首尾处指定的字符,默认删除空白符(包括'\n', '\r', '\t', ' '). s.st ...

  8. 【BZOJ-1218】激光炸弹 前缀和 + 枚举

    1218: [HNOI2003]激光炸弹 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 1778  Solved: 833[Submit][Statu ...

  9. 【BZOJ-4127】Abs 树链剖分 + 线段树 (有趣的姿势)

    4127: Abs Time Limit: 40 Sec  Memory Limit: 256 MBSubmit: 381  Solved: 132[Submit][Status][Discuss] ...

  10. 【BZOJ-1060】时态同步 树形DP (DFS爆搜)

    1060: [ZJOI2007]时态同步 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 2101  Solved: 595[Submit][Statu ...