【发布时间】:2017-04-03 04:06:33
【问题描述】:
这是我的 html,它会为每个从 $http.get 服务获得的响应创建配置文件。
<div class="container" ng-controller="profileController" ng-init="loadProfilesData()">
<div ng-repeat="p in profileData">
<div>{{p.company}}</div>
<div>{{p.country}}</div>
<div gauge-chart class="gauge" id="first-{{p.Id}}" value=p.value*100 min=0 max=100 gauge-width-scale=0.8 title=""
donut=false relative-gauge-size=true symbol='%' hide-min-max=true></div>
<div gauge-chart class="gauge" id="second-{{p.Id}}" value=p.value*100 min=0 max=100 gauge-width-scale=0.8 title=""
donut=false relative-gauge-size=true symbol='%' hide-min-max=true></div>
<span>
{{ p.value | date: "hh:mm:ss" }}
</span>
</div>
</div>
我得到的回复如下
{
ID: "1",
employeeList: {
[{"Value":0.003,"Stat":{"parameter":0,"Name":"test0","Tag":"Devo100"}},
{"Value":0.004,"Stat":{"parameter":0,"Name":"test1","Tag":"Devo101"},
{"Value":0.005,"Stat":{"parameter":0,"Name":"test2","Tag":"Devo102"}]
},
comapny: "MSDFT",
department: "Sales",
country: "USA"
},
{
ID: "2",
employeeList: null,
comapny: "MSDFT",
department: "Sales",
country: "USA"
},
{
ID: "3",
employeeList: [{"Value":0.003,"Stat":{"parameter":0,"Name":"test0","Tag":"Devo100"}},
{"Value":0.004,"Stat":{"parameter":0,"Name":"test1","Tag":"Devo101"}],
comapny: "MSDFT",
department: "Sales",
country: "USA"
}
因为我得到了名称、值的内部列表,有时我得到这个列表employeeList 为空。我需要为employeeList 设置另一个ng-repeat。请建议我如何绑定,因为订购也是随机的。
【问题讨论】:
标签: angularjs json angularjs-ng-repeat