无法通过ng-repeat检索数据

时间:2014-10-17 17:47:12

标签: json angularjs-ng-repeat

我的HTML看起来像

<div class="proficiency" id="proficiencylist">
    <table>
        <span ng-repeat="group in chapterGroups">
            <tr>
                <td id="grp" style="text-overflow: ellipsis;">{{group.groupName}}
                </td>                   
            </tr>
            <span ng-repeat="chapter in group.chapters">
                <td id="chaptd" style="text-overflow: ellipsis;">{{chapter.name}}
                </td>
                <span ng-repeat="chapProf in proficiency.chapterProfList | filter : {chapterId: chapter.id} : true">
                    <td><label><span class="rating-static rating-{{(chapProf.chapterProf | number:0) * 10}}"></span></label></td>
                </span>                     
            </span>
        </span>
    </table>

</div>

我的groupchapters json是

[  
   {  
      "groupId":"1325519",
      "groupName":"Part 1: Setting the Context for Management",
      "chapters":[  
         {  
            "name":"Part 1: \n            Introduction\n          ",
            "id":"EKHXAZ666861716"
         },
         {  
            "name":"1: Introduction to Management",
            "id":"QGRNTJ390585712"
         },
         {  
            "name":"2: The Global Business Environment",
            "id":"ZUBPWG817393950"
         },
         {  
            "name":"3: Ethics and Corporate Social Responsibility",
            "id":"ASDMHY855087184"
         }
      ]
   },
   {  
      "groupId":"1325528",
      "groupName":"Part 2: Strategic Perspective",
      "chapters":[  
         {  
            "name":"Part 2: \n            Introduction\n          ",
            "id":"EUPFYT208991652"
         },
         {  
            "name":"4: Introduction to Strategy",
            "id":"DAUCDE724464546"
         },
         {  
            "name":"5: Business-Level Strategy",
            "id":"WHOKLD069096566"
         },
         {  
            "name":"6: Corporate-Level Strategy",
            "id":"YTLQQV206169325"
         }
      ]
   }
]

精通json

{  
   "proficiency":3,
   "chapterProfList":[  
      {  
         "chapterProf":2,
         "chapterName":"CH-1",
         "chapterId":"AXYSZS774674672",
         "chapterLOProfList":[  
            {  
               "loName":"Learning OBjective 1",
               "loProficiency":2
            }
         ]
      },
      {  
         "chapterProf":3,
         "chapterName":"CH-2",
         "chapterId":"hdjasgdhasg76342746",
         "chapterLOProfList":[  
            {  
               "loName":"Learning OBjective 2",
               "loProficiency":5
            }
         ]
      }
   ]
}

我无法通过ng-repeat

检索数据

当我像{{chapterGroups[0].groupName}}手动提供索引时,我得到了答案 或{{chapterGroups[0].chapters[1].name}}。但是当我给ng-repeat时,我没有得到任何价值。

0 个答案:

没有答案