我想顯示一個JSON代碼到一個HTML表格。我有這樣的JSON:我如何顯示在HTML角度嵌套的JSON元素
posts:[
{
"category":[],
"status":[]
},
{
"category":
[
{
"ID_post":"2",
"category":"5 Reasons",
"ID_cat":"1"
},
{
"ID_post":"2",
"category":"Advertising",
"ID_cat":"2"
}
],
"status":
[
{
"ID_post":"2",
"status":"Approved",
"ID_stat":"1",
"color":"red"
},
{
"ID_post":"2",
"status":"Placed",
"ID_stat":"2",
"color":"#1800fb"
}
]
}
]
我想說明的狀態的顏色爲HTML表是這樣的:
<tr>
<th>Web Status</th>
</tr>
<tbody ng-repeat="post in posts | startFrom: start | limitTo: limit">
<tr>
<td>{{post.status}}</td>
</tr>
</tbody>
它返回的東西像這樣在第二篇文章中:
[{"ID_post":"2","status":"Approved","ID_stat":"1","color":"red"},{"ID_post":"2","status":"Placed","ID_stat":"2","color":"#1800fb"}]
但我需要每個崗位的顏色。我怎麼才能得到它?我試着用post.status.color,但它不起作用。 有人可以幫我嗎? 謝謝!