AngularJs的UI组件ui-Bootstrap分享(十三)——Progressbar

本文详细介绍了在Angular中使用UI Bootstrap组件库提供的两种进度条控件的方法。一种是uib-progressbar指令,用于展示单一颜色和进度;另一种是由uib-bar和uib-progress指令组成的进度条,可以展示多种颜色和多个进度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址:http://www.cnblogs.com/pilixiami/p/5723593.html

进度条控件有两种指令,第一种是uib-progressbar指令,表示单一颜色和进度的一个进度条。第二种是uib-bar和uib-progress指令,表示多种颜色和多个进度组合而成的一个进度条。

这是一个使用uib-progressbar指令的例子:

 

<!DOCTYPE html>
<html ng-app="ui.bootstrap.demo" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/Content/bootstrap.css" rel="stylesheet" />
    <title></title>

    <script src="/Scripts/angular.js"></script>
    <script src="/Scripts/ui-bootstrap-tpls-1.3.2.js"></script>
    <script>
        angular.module('ui.bootstrap.demo', ['ui.bootstrap']).controller('ProgressDemoCtrl', function ($scope) {
            $scope.val = 90;
        });
    </script>

</head>
<body>
    <div ng-controller="ProgressDemoCtrl">
        <uib-progressbar value="val" type="success">{{val}}%</uib-progressbar>
    </div>
</body>
</html>

 

效果为:

其中,可使用的属性有:

 属性名 默认值备注 
 value  进度条当前的值
type  null 进度条类型,可设置为success, info, warning, danger
max 100  进度条的最大值
animate  true 是否启用动画
 title progressbar 辅助用的标题

 另一种进度条是组合多个进度的进度条:

 

<!DOCTYPE html>
<html ng-app="ui.bootstrap.demo" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/Content/bootstrap.css" rel="stylesheet" />
    <title></title>

    <script src="/Scripts/angular.js"></script>
    <script src="/Scripts/ui-bootstrap-tpls-1.3.2.js"></script>
    <script>
        angular.module('ui.bootstrap.demo', ['ui.bootstrap']).controller('ProgressDemoCtrl', function ($scope) {
            $scope.bars = [
                { value: "30", type: "info" },
                { value: "30", type: "warning" },
                { value: "35", type: "danger" }
            ];
        });
    </script>

</head>
<body>
    <div ng-controller="ProgressDemoCtrl">
        <uib-progress>
        <uib-bar ng-repeat="bar in bars track by $index" value="bar.value" type="{{bar.type}}">{{bar.value}}%
            </uib-bar>
        </uib-progress>
    </div>
</body>
</html>

 

效果为:

uib-progress可使用的属性有:max、animate、title,uib-bar可使用的属性有value、type、title,这些属性的用法和uib-progressbar一样。

 

转载于:https://www.cnblogs.com/gongshunkai/p/6752626.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值