2014-04-01 134 views
0

我有一個包含許多對象的對象。 objects屬性是一個用戶名屬性,包含一個屬性是組的對象,值爲true或false。嵌套Ng-Repeat和對象屬性

ReportModel.Taxonomy = { 
    Authenticated Users: Object 
    Test Group 1: " ✓ " 
    Test Group 2: " ✓ " 
    Test Group 3: " - " 
    Test Group 4: " - " 
    Test Group 5: " ✓ " 
    Test Group 6: " - " 
    Test Group 7: " - " 
    Test Group 8: " ✓ " 
    TestGroup: " - " 
Test Users: Object 
    Test Group 1: " - " 
    Test Group 2: " - " 
    Test Group 3: " - " 
    Test Group 4: " ✓ " 
    Test Group 5: " - " 
    Test Group 6: " ✓ " 
    Test Group 7: " - " 
    Test Group 8: " - " 
    TestGroup: " - " 
} 

我一直在嘗試使用NG-重複,每一行,頭後,提供的用戶名(第1列),結果爲每個組創建一個表:

<table> 
     <tr class="reportHeader" > 
      <th>USERS</th> 
      <th ng-repeat="group in ReportModel.groups">{{group.name}}</th> 
     </tr> 
     <tr ng-repeat="user in ReportModel.taxonomy"> 
      <td>{{user.name}}</td> 
      <td ng-repeat="user.userGroups"></td> 
     </tr> 
    </table> 

我無法弄清楚如何使用ngRepeat給定Taxonomy對象的設置方式。

回答