我有一个进度条,而不是从零开始的值,它从其他值开始,然后回到零,然后继续前进。
进度条代码
<div class="modal-header">
</div>
<div class="modal-body">
<div>
<progressbar class="progress-striped active" max="100" type='success' value="progress"></progressbar>
</div>
在modal的开放函数中 -
function open(){
$scope.progress = 0;
var modalInstance = $modal.open({
animation: true,
templateUrl: 'views/progressBar.html',
controller: 'progressController',
scope: $scope
});
};
controller.js
angular.module('app').controller('progressController', function($scope, $modalInstance) {
$scope.$watch('length', function() {
if ($scope.length==0 && $scope.progress!=0) {
$modalInstance.close();
}
});
});
答案 0 :(得分:0)
您在open函数中设置$ scope.progress = 0,尝试在加载控制器时将其设置为0。
angular.module('app').controller('progressController', function($scope, $modalInstance) {
$scope.progress = 0;
$scope.$watch('length', function() {
if ($scope.length==0 && $scope.progress!=0) {
$modalInstance.close();
}
});
});