我試圖顯示cList中的每個項目,但它不工作。它創建正確數量的div標籤(來自ng-repeat),但它們是空的。它看起來像項目是不確定的,所以沒有顯示。angularjs ng-repeat item is undefined
這是控制器:
var app = angular.module('MyApp');
app.controller('listController', function($scope) {
$scope.cList = [ 'c1', 'c2', 'c3', 'c4', 'c5' ];
});
這是HTML:
<div ng-controller="listController">
<div ng-repeat="item in cList">
{{item}}
</div>
</div>
它產生這個HTML重複5次:
<div ng-repeat="item in cList" class="ng-scope">
</div>
<!-- end ngRepeat: item in cList -->
如果我把別的東西在ng-repeat中的div標籤,它將在頁面上顯示5次。有沒有任何理由,該項目將不明確?
替換下面的代碼
你檢查回答? – Sajeetharan
@sajeetharan它沒有解決問題。這可能是項目設置方式的問題嗎? – Neil
你能給我團隊查看器嗎? – Sajeetharan