2014-01-19 52 views
0

我檢查了這個錯誤:AngularJS錯誤

Error: [ngRepeat:dupes] http://errors.angularjs.org/1.2.9/ngRepeat/dupes?p0=subject%20in%20subjects&p1=string%3A%D0%90%D1%81%D1%82%D1%80%D0%BE%D0%BD%D0%BE%D0%BC%D0%B8%D1%8F 
    at Error (<anonymous>) 
    at http://vedomosti/js/angular.min.js:6:449 
    at http://vedomosti/js/angular.min.js:184:445 
    at Object.fn (http://vedomosti/js/angular.min.js:99:371) 
    at h.$digest (http://vedomosti/js/angular.min.js:100:299) 
    at h.$apply (http://vedomosti/js/angular.min.js:103:100) 
    at f (http://vedomosti/js/angular.min.js:67:98) 
    at E (http://vedomosti/js/angular.min.js:71:85) 
    at XMLHttpRequest.v.onreadystatechange (http://vedomosti/js/angular.min.js:72:133) angular.min.js:84 

但我不明白的地方我的錯......

我正在寫學校申請。我在MySQL中有表學校。 與田野: id,名稱,1,2,3,4,5,6,7,8,9,10,11

1,2,3,4 ...它是類,他們有有關科目的信息。每個班級都有自己的科目。現在我正在編寫部分,用戶可以在其中將課程設置爲課程。 1至10個班級都很好。但是當我點擊「加載11級課程」時,我得到這個錯誤。

此表與受試者:

div class="large-6 column"> 
       <label>Предметы {{class}} класса</label> 
       <table> 
        <thead> 
        <tr> 
         <th style="width: 200px;">Предмет</th> 
         <th style="width: 200px;">Изменить</th> 
        </tr> 
        </thead> 
        <tbody> 
        <tr ng-repeat="subject in subjects"> 
         <td>{{subject}}</td> 
         <td><a>изменить</a></td> 
        </tr> 
        </tbody> 
       </table> 
      </div> 

而對於負載信息的其它類按鈕:

<button class="button success tiny" ng-click="getSCLASS()">получить</button> 

和作用該按鈕:

$scope.getSCLASS = function(){ 
     $http.post("/index.php/panel/getSCLASS", {class:$scope.class}).success(function(data){ 
      $scope.subjects = data; 
      $scope.s_subjects = true; 

     }); 
    } 

從1至10的類 - 一切正常。但是11節課沒有用。我不明白我的錯誤在哪裏。

對不起,我的英語:

回答

2

this和嘗試這個辦法:

<div class="large-6 column"> 
    <label>Предметы {{class}} класса</label> 
    <table> 
     <thead> 
     <tr> 
      <th style="width: 200px;">Предмет</th> 
      <th style="width: 200px;">Изменить</th> 
     </tr> 
     </thead> 
     <tbody> 
     <tr ng-repeat="subject in subjects track by $index"> 
      <td>{{subject}}</td> 
      <td><a>изменить</a></td> 
     </tr> 
     </tbody> 
    </table> 
</div> 
+0

THX,它的工作... – user3169724

+0

也許通過subject.id'更改爲'軌道??? –