我有下面的JSON数据
[Beds = [
ElectricHospitalBed = [{name: 'Multifunctional electric hospital bed', code: 'IHC B/E 1001'},
{name: 'Multifunctional electric hospital bed', code: 'IHC B/E 1002'},
{name: 'Five functional electric hospital bed with ACP', code: 'IHC B/E 1003'},
{name: 'Five functional electric hospital bed', code: 'IHC B/E 1004'},
{name: 'Five functional electric hospital bed with ACP', code: 'IHC B/E 1005'},
{name: 'Five functional electric hospital bed', code: 'IHC B/E 1006'},
{name: 'Three functional electric hospital bed', code: 'IHC B/E 1007'},
{name: 'Three functional electric hospital bed', code: 'IHC B/E 1008'},
{name: 'Five functional electric hospital bed', code: 'IHC B/E 1009'}],
Semi electric hospital bed = [],
Manual hospital bed = [],
Home care bed = [],
Orthopedics bed = [],
Childrens bed] = [],
Trollies = [Patient trolley = [],
Stretcher = [],
Nursing trolley [],
Cambered trolley=[]]
]我必须通过AngularJS ng-重复属性列出所有产品的名称(假设每个对象都是一个产品)。请指点。
注意:这个JSON数据分配给一个名为ProductsData的控制器中的一个名为products的变量。
发布于 2016-02-27 06:58:04
是不是像[Beds = [{},{}],[{},{}],[{},{}], Trolleys = [],[],[],]?
<div ng-repeat="c in products">
<div ng-repeat="p in c">
{{c.name}}
</div>
</div>C类产品,如床、手推车等。
P是每个类别中的项目,
c.name应该给你你需要的东西。
发布于 2016-02-27 07:13:11
纠正您的json格式的问题。
无论如何,我在jsbin 这里中进行了更改和实现。
https://stackoverflow.com/questions/35666683
复制相似问题