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. Mybatis 异常: The content of elements must consist of well-formed character data or markup

    原因很简单:在ibatis的配置文件中不能出现小于号(>)     <delete id="deleteByPrimaryKey" parameterType=&quo ...

  2. (转)ElasticSearch学习

    ElasticSearch是一个基于Lucene构建的开源,分布式,RESTful搜索引擎.设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便.支持通过HTTP使用JSON进行数据索引 ...

  3. 二、处理MVC多级目录问题——以ABP为基础架构的一个中等规模的OA开发日志

    就个人感觉而言.ASP.NET MVC是一种非常反人类的设计.(我没有接触过Java的MVC,不知道两者是否一样.如果一样,那么搞Java的同学也挺可怜.)尤其是MVC的路由机制,灰常灰常反动.路由所 ...

  4. mac下卸载MySQL

    所有跟mysql相关进程都停止掉, 然后终端输入: cd ~/ sudo rm /usr/local/mysqlsudo rm -rf /usr/local/var/mysqlsudo rm -rf ...

  5. hadoop-MapReduce分布式计算框架

    计算框架: MapReduce:主要用于离线计算 Storm:流式计算框架,更适合做实时计算 stack:内存计算框架,快速计算 MapReduce设计理念: --何为分布式计算 --移动计算,而不是 ...

  6. leetcode 235. Lowest Common Ancestor of a Binary Search Tree

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...

  7. 【bzoj1500】 noi2005—维护数列

    http://www.lydsy.com/JudgeOnline/problem.php?id=1500 (题目链接) 题意 要求维护数列,操作有区间删除,区间插入,区间反转,区间修改,区间求和,求最 ...

  8. webapi获取IP的方式

    using System.Net.Http; public static class HttpRequestMessageExtensions { private const string HttpC ...

  9. Linux 开机 logo 修改

    从内核被解压到文件系统被挂载,我们看到的经典画面是一个小企鹅.如果嫌小企鹅枯燥,我们可以把它换掉. 1. 准备图片 这里需要的是 ppm 图片,所以,我们需要把常见格式给转换为 .ppm 才能使用.c ...

  10. POJ2456 Aggressive cows

    Aggressive cows 二分,关键是转化为二分! #include <cstdio> #include <algorithm> ; ; int N, C; int a[ ...