我想将Java EE Web应用程序分解为2个部分,包含Web服务并在Spring框架中构建的服务器,以及包含Angular JS中的客户端接口的客户端。
2个应用程序现在将具有不同的域名,因此第一个问题是客户端中的角度请求被拒绝。所以我在stackoverflow中找到的解决方案是我必须在服务器中启用交叉请求并在客户端中使用交叉请求。我通过这种方式处理,并成功请求到达服务器。
现在的问题是我使用ng-repeat来显示我从Web服务获得的列表,当我通过console.log检查时,该列表包含真正的正确数据。但是ng-repeat标签不起作用,当我刷新页面时,这个错误出现在控制台中:
angular.js:14328 Error: [ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: lCat in listeCategories track by lCat.idCategorie, Duplicate key: undefined, Duplicate value: {
http://errors.angularjs.org/1.6.1/ngRepeat/dupes?p0=lCat%20in%20listeCategories%20track%20by%20lCat.idCategorie&p1=undefined&p2=%7B
at angular.js:68
at ngRepeatAction (angular.js:30804)
at $watchCollectionAction (angular.js:17677)
at Scope.$digest (angular.js:17814)
at angular.js:18011
at completeOutstandingRequest (angular.js:6111)
at angular.js:6390
你觉得怎么样?
答案 0 :(得分:0)
您需要添加track by $index
以避免重复时重复。