【发布时间】:2014-09-23 13:01:18
【问题描述】:
{
"imports": {
"imported": [
{
"date": "19/9/2014",
"item": [
{
"sn": "3366698",
"type": "Food",
"weight": "10tn."
},
{
"sn": "3366699",
"type": "Eqipment",
"weight": "20kg."
}
]
},
{
"date": "20/9/2014",
"item": [
{
"sn": "3366700",
"type": "Electronics",
"weight": "100pt."
},
{
"sn": "3366701",
"type": "Food",
"weight": "5tn."
}
]
}
]
}
}
我有这个 json,但我不确定它的结构是否正确。我正在尝试通过以下 $.getJSON 方法将每个项目类型(包括重复项)呈现为表头:
$scope.items = data.imports.item;
和 HTML 为:
<table border="1" >
<thead>
<tr>
<th ng-repeat="item in items">{{item.type}}</th>
</tr>
</thead>
</table>
但我没能成功。我做错了什么?
编辑:jsfiddler
【问题讨论】:
标签: json angularjs angularjs-scope angularjs-ng-repeat