angularjs的进度条

项目里需要一个进度条,所以就在网上查找资料学习,看到了网友“雪狼”的代码分享,写的很高明,很精练,很厉害,原文链接:http://www.ngnice.com/showcase/#/show/progress,结合自己的项目需要,自己改编了个简单的进度条,可以加在项目里面,进度条的开始和结束由自己决定。


var myApp = angular.module('myApp', []);

myApp.controller('main', ['$scope', '$interval', function($scope, $interval){
var vm = $scope.vm = {};
vm.value = 0;
vm.style = 'progress-bar-danger';
vm.showLabel = true;
vm.striped = true;

$scope.selectValue = function (){
console.log(vm.style);
};
var index = 0;
var timeId = 500;
$scope.count = function(){
var start = $interval(function(){
vm.value = ++index;
if (index > 99) {
$interval.cancel(start);
}
if (index == 60) {
index = 99;
}
}, timeId);
};

}]);



2. [代码]html
<div ng-class="{progress: true, 'progress-striped': vm.striped}" class="col-md-4">
<div ng-class="['progress-bar', vm.style]" ng-style="{width: vm.value + '%'}">
<div ng-if="vm.showLabel">{{vm.value}}%</div>
</div>
</div>
<button class="btn btn-success" ng-click="count()">开始进度</button>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值