对于createHttpBackend,AngularJS“不允许在转发器中复制”

时间:2013-12-12 18:08:29

标签: angularjs

我的AngularJS应用程序适用于用户(Tomcat,使用他们的个人Firefox)。

运行Selenium测试(Jetty,Firefox)时,会出现一些我无法解释的异常:

Error: Duplicates in a repeater are not allowed. Repeater: uuid in ngModel key: string:5
ngRepeatAction@http://localhost:60690/webapp/frontend/app/lib/angular/angular.js:15407
$watchCollectionAction@http://localhost:60690/webapp/frontend/app/lib/angular/angular.js:8717
Scope.prototype.$digest@http://localhost:60690/webapp/frontend/app/lib/angular/angular.js:8811
Scope.prototype.$apply@http://localhost:60690/webapp/frontend/app/lib/angular/angular.js:9012
done@http://localhost:60690/webapp/frontend/app/lib/angular/angular.js:10265
completeRequest@http://localhost:60690/webapp/frontend/app/lib/angular/angular.js:10449
createHttpBackend/</xhr.onreadystatechange@http://localhost:60690/webapp/frontend/app/lib/angular/angular.js:10407

return logFn.apply(console, args);

现在,有趣的是:它正在谈论的重复字符串(在这种情况下为“5”,但我已经看到了其他值,你将从下面理解)似乎是GUID的一部分我正在使用它作为通话的一部分。因此GUID也在URL和请求正文中。 (所以当我的GUID是c2d21d9c-9e14时......它会在“2”上失败。)

我对转发器中不需要重复项有一些基本的了解,但为什么在这些Angular代码中由转发器处理文本字符串?当然文本字符串中使用了重复的字符,对吧?!

无论如何,我对这个问题的解决方案非常满意。但更一般地说:我将如何解决这样的问题?它是异步的而不是我的代码......非常感谢!

1 个答案:

答案 0 :(得分:0)

AngularJS不支持ng-repeat指令中的重复项。 尝试像bellow代码段。

<div ng-repeat="r in [5,5,5] track by $index">