我有一組JSON數據的,並在其中,我試圖計算的陣列的長度(相關信息):AngularJS - JSON陣列的計算長度
我的JSON:
"Association": {
"Items": [
{
"AssocName": {
"SurName": "BLOGGS",
"Title": "MR",
"ForeName": "HAPPY"
},
"Details": [
{
"Name": {
"SurName": "BLOGGS",
"Title": "MR",
"ForeName": "HAPPY"
},
"Infos": [
{
//Some Data
//Some Data
//Some Data
},
{
//Some Data
//Some Data
//Some Data
},
{
//Some Data
//Some Data
//Some Data
},
{
//Some Data
//Some Data
//Some Data
}
]
}
]
},
{
"AssocName": {
"SurName": "BLOGGS",
"Title": "MRS",
"ForeName": "BLUE"
},
"Details": [
{
"Name": {
"SurName": "BLOGGS",
"Title": "MRS",
"ForeName": "BLUE"
},
"Infos": [
{
//Some Data
//Some Data
//Some Data
},
{
//Some Data
//Some Data
//Some Data
}
]
}
]
}
]
}
我HTML:
<tr ng-repeat-start="associations in Association.Items track by $index">
<td>
{[{associations.AssocName.Title}]}
{[{associations.AssocName.ForeName}]}
{[{associations.AssocName.SurName}]}
</td>
<td>
{[{ associations[$index].Details.Infos.length }]} of Details
</td>
</tr>
但似乎沒有顯示valus ...標題,姓名和姓氏顯示如預期。
這是行得通的 - 謝謝。 – 2014-09-01 13:57:20