AngularJS 使用ng-repeat報錯 [ngRepeat:dupes]
AngularJS 使用ng-repeat報錯
[ngRepeat:dupes] Duplicates in a repeater are not allowed. Use 'track by' expression to specify uniq
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
發(fā)現(xiàn)是因為相同的內(nèi)容重復引起,解決方案
<div ng-init="words = ['高校','高校','高校']" ng-repeat="word in words track by $index"> {{word}} </div>
在ng-repeat后面加上
track by $index
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關文章
AngularJS使用ngOption實現(xiàn)下拉列表的實例代碼
這篇文章主要介紹了AngularJS使用ngOption實現(xiàn)下拉列表的實例代碼的相關資料,需要的朋友可以參考下2016-01-01Angular?結(jié)合?dygraphs?實現(xiàn)?annotation功能
這篇文章主要介紹了Angular?結(jié)合?dygraphs?實現(xiàn)?annotation,本文,我們直接結(jié)合 Angular 來演示,如何通過 dygraphs 實現(xiàn)折線圖上的 annotation 的功能,需要的朋友可以參考下2022-08-08實例剖析AngularJS框架中數(shù)據(jù)的雙向綁定運用
這篇文章主要介紹了AngularJS框架中數(shù)據(jù)的雙向綁定運用實例,包括數(shù)據(jù)綁定中的關鍵函數(shù)與監(jiān)聽器觸發(fā)的相關講解,需要的朋友可以參考下2016-03-03angular6?Error:Debug?Failure?at?typeToString解決分析
這篇文章主要為大家介紹了angular6?Error:Debug?Failure?at?typeToString解決分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-11-11