0
我有兩個JSON對象。一個JSON對象應該爲我提供第二個JSON對象的鍵。
JSON 1(tableInfo):無法使用ng-repeat訪問JSON
[
-{
name: "id",
dataType: "Integer",
isEditable: false
}
-{
name: "article",
dataType: "String",
isEditable: true
}
-{
name: "publisher",
dataType: "String",
isEditable: false
}
-{
name: "metadata.comments",
dataType: "Integer",
isEditable: false
}
]
JSON 2(currentInfo):
[
-{
id: 0,
article: "JavaScript Conquers the World",
publisher: "Daily Times",
metadata: {
comments: 4
}
}
-{
id: 1,
article: "The Problem with Foobar",
publisher: "New York Times",
metadata: {
comments: 27
}
}
]
我想使用納克 - 重複(或類似的指示),以在JSON 2作爲顯示信息JSON 1的「名稱」起到列分隔符的作用(例如|「id」|「article」|「publisher」|)
我知道得到JSON 1的名稱功能我可以輕鬆地做一個
<tr ng-repeat="item in tableInfo">
<td>{{item.name}}</td>
</tr>
但是,如何訪問JSON 2中每個元素的每個屬性(item.name)?
我遇到了使用此方法訪問metadata.comments的麻煩,但它絕對幫助我取得了進展。謝謝! –