1
我正在为每个对象设备做进度条。如何查看所有ng-init内容?
这里是我的AngularJS代码:
$scope.progressBarEquipements=function(idEquipement) {
$http.get(url+"/RestResponseCheckLists?idEq="+idEquipement)
.success(function(data) {
$scope.Pourcentage = data;
}).error(function(err, data) {
console.log("error : " +data);
});
};
该函数返回$scope.progressBarEquipements=function(idEquipement)
:
console.log("data "+Pourcentage);
/**
* [{'NB_Resp':2,'NB_checks':154}] //For the first object And the others not
*/
这里是我的HTML代码:
<div class="col-md-4" ng-repeat="eq in Checksf" ng-init="progressBarEquipements(eq.idEquipements)">
<h4 class="list-group-item-heading" >{{eq.nomEq}} </h4>
<div class="progress progress-lg m-b-5" >
<div class="progress-bar progress-bar-purple" role="progressbar" ng-repeat="p in Pourcentage" ng-style="{width:{{((p.NB_Resp/p.NB_checks) * 100)}} + '%'}">
{{((p.NB_Resp/p.NB_checks) * 100) | number:0}}%
</div>
</div>
</div>
所以我有四个项目的设备是显示在html页面中。
$scope.Percentage
仅显示 第一个对象的进度栏计算。
如何显示每个对象在进度条中的计算?
预先感谢您
根据最后修改,它与我合作,谢谢先生, – Michael1
我已经看到您的编辑,并确定,我错过了“百分比”到您的对象,但我不认为应该重复ng在那里,每次只有一件物品。 –
'eq.Pourcentage'返回两个对象。如何浏览。所以,添加'ng-repeat'。我测试过这种情况,它适用于我 – Michael1