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