跟随this article
但这似乎不适用于我的json结构。这是我的json
$scope.trucks = [{
id: 4,
truckNumber: '50LD 02456',
driverName: 'Dẻo',
shipments: [{
id: 1,
routeCode: "THC-VinhHao",
trip: 2
}, {
id: 2,
routeCode: "THC-VinhHao(R)",
trip: 3
}, {
id: 3,
routeCode: "THC2-Hiệp Thành HM",
trip: 3
}]
}, {
id: 5,
truckNumber: '61C 03948',
driverName: 'Hưng',
shipments: [{
id: 4,
routeCode: "TBC-VBL HMo",
trip: 1
}, {
id: 5,
routeCode: "THC2-Hiệp Thành HM",
trip: 4
}]
}];
<ul>
<li data-ng-repeat="truck in trucks">
{{truck.truckNumber}}
<br />
<ul>
<li data-np-repeat="shipment in truck.shipments">{{shipment.routeCode}}</li>
</ul>
</li>
</ul>
任何帮助表示赞赏。谢谢阅读。
最佳答案
请确保您正确说明了所有内容。 ng-repeat拼写错误。
<ul>
<li data-ng-repeat="truck in trucks">
{{truck.truckNumber}}
<br/>
<ul>
<li data-ng-repeat="shipment in truck.shipments">{{shipment.routeCode}}</li>
</ul>
</li>
</ul>
关于javascript - Angular.js:Angular中的嵌套重复不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30320683/