- Angular Material 教程
- Angular Material - 首页
- Angular Material - 概述
- 环境设置
- Angular Material - 自动完成
- Angular Material - 底部菜单
- Angular Material - 卡片
- Angular Material - 小部件
- Angular Material - 布局
- Angular Material - 输入框
- Angular Material - 图标
- Angular Material - 网格
- Angular Material - 侧边导航栏
- Angular Material - 浮动操作按钮 (Fab) 速拨盘
- Angular Material - 副标题
- Angular Material - 滑动
- Angular Material - 开关
- Angular Material - 主题
- Angular Material - 提示信息
- Angular Material - 排版
- Angular Material - 虚拟滚动
- Angular Material - 白框
- Angular Material 有用资源
- Angular Material - 快速指南
- Angular Material - 有用资源
- Angular Material - 讨论
Angular Material - 进度条
md-progress-circular 和 md-progress-linear 是 Angular 的进度指示器指令,用于在应用程序中显示加载内容消息。
属性 - md-progress-circular
下表列出了md-progress-circular的不同属性的参数和描述。
序号 | 参数和描述 |
---|---|
1 | * md-mode 从两种模式中选择一种:'determinate'(确定性)和 'indeterminate'(不确定性)。如果 md-mode 值设置为未定义或指定为非这两种有效模式之一,则 .ng-hide 将自动作为样式应用于组件;如果未配置,则 md-mode = "indeterminate" 将自动注入为属性。但是,如果也指定了 value = "",则 md-mode = "determinate" 将自动注入。 |
2 | value 在确定性模式下,此数字表示圆形进度的百分比。默认值为 0。 |
3 | md-diameter 这指定了圆形进度的直径。该值可以是百分比(例如“25%”)或像素大小值(例如“48”)。如果此属性不存在,则假定默认值为“48px”。 |
示例
以下示例显示了md-progress-circular指令的使用以及圆形进度条的使用。
am_circularprogressbars.htm
<html lang = "en"> <head> <link rel = "stylesheet" href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css"> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script> <link rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons"> <script language = "javascript"> angular .module('firstApplication', ['ngMaterial']) .controller('progressbarsController', progressbarsController); function progressbarsController ($scope, $interval) { var self = this, j = 0, counter = 0; self.modes = [ ]; self.activated = true; self.determinateValue = 30; self.toggleActivation = function() { if ( !self.activated ) self.modes = [ ]; if ( self.activated ) j = counter = 0; }; $interval(function() { self.determinateValue += 1; if (self.determinateValue > 100) { self.determinateValue = 30; } if ( (j < 5) && !self.modes[j] && self.activated ) { self.modes[j] = 'indeterminate'; } if ( counter++ % 4 == 0 ) j++; }, 100, 0, true); } </script> </head> <body ng-app = "firstApplication"> <div id = "progressbarsContainer" ng-controller = "progressbarsController as ctrl" layout = "column" ng-cloak> <h4 style = "margin-top:10px">Determinate </h4><p></p> <div layout = "row" layout-sm = "column" layout-align = "space-around"> <md-progress-circular md-mode = "determinate" value = "{{ctrl.determinateValue}}"></md-progress-circular> </div> <h4 style = "margin-top:10px">Indeterminate </h4> <div layout = "row" layout-sm = "column" layout-align = "space-around"> <md-progress-circular md-mode = "indeterminate"></md-progress-circular> </div> <h4 style = "margin-top:10px">Theme Based</h4> <div layout = "row" layout-sm = "column" layout-align = "space-around"> <md-progress-circular class = "md-hue-2" md-mode = "{{ctrl.modes[0]}}" md-diameter = "20px"></md-progress-circular> <md-progress-circular class = "md-accent" md-mode = "{{ctrl.modes[1]}}" md-diameter = "40"></md-progress-circular> <md-progress-circular class = "md-accent md-hue-1" md-mode = "{{ctrl.modes[2]}}" md-diameter = "60"></md-progress-circular> <md-progress-circular class = "md-warn md-hue-3" md-mode = "{{ctrl.modes[3]}}" md-diameter = "70"></md-progress-circular> <md-progress-circular md-mode = "{{ctrl.modes[4]}}" md-diameter = "96"> </md-progress-circular> </div> <hr ng-class = "{'visible' : ctrl.activated}"> <div id = "loaders" layout = "row" layout-align = "start center"> <p>Progress Circular Indicators: </p> <h5>Off</h5> <md-switch ng-model = "ctrl.activated" ng-change = "ctrl.toggleActivation()" aria-label = "Toggle Progress Circular Indicators"> <h5>On</h5> </md-switch> </div> </div> </body> </html>
结果
验证结果。
属性 - md-progress-linear
下表列出了md-progress-linear的不同属性的参数和描述。
序号 | 参数和描述 |
---|---|
1 | * md-mode 从两种模式中选择一种:'determinate'(确定性)和 'indeterminate'(不确定性)。如果 md-mode 值设置为未定义或指定为非这两种有效模式之一,则.ng-hide将自动作为样式应用于组件;如果未配置,则md-mode = "indeterminate"将自动注入为属性。但是,如果value = ""也指定了,则md-mode="determinate"将自动注入。 |
2 | md-buffer-value 在确定性模式下,此数字表示主进度条的百分比。默认值为 0。 |
3 | md-diameter 在缓冲模式下,此数字表示次要进度条的百分比。默认值为 0。 |
示例
以下示例显示了md-progress-circular指令的使用以及线性进度条的使用。
am_linearprogressbars.htm
<html lang = "en"> <head> <link rel = "stylesheet" href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css"> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script> <script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script> <link rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons"> <script language = "javascript"> angular .module('firstApplication', ['ngMaterial']) .controller('progressbarsController', progressbarsController); function progressbarsController ($scope, $interval) { var self = this, j = 0, counter = 0; self.modes = [ ]; self.activated = true; self.determinateValue = 30; self.toggleActivation = function() { if ( !self.activated ) self.modes = [ ]; if ( self.activated ) j = counter = 0; }; $interval(function() { self.determinateValue += 1; if (self.determinateValue > 100) { self.determinateValue = 30; } if ( (j < 5) && !self.modes[j] && self.activated ) { self.modes[j] = 'indeterminate'; } if ( counter++ % 4 == 0 ) j++; }, 100, 0, true); } </script> </head> <body ng-app = "firstApplication"> <div id = "progressbarsContainer" ng-controller = "progressbarsController as ctrl" layout = "column" ng-cloak> <h4 style = "margin-top:10px">Determinate </h4><p></p> <div layout = "row" layout-sm = "column" layout-align = "space-around"> <md-progress-linear md-mode = "determinate" value = "{{ctrl.determinateValue}}"></md-progress-circular> </div> <h4 style = "margin-top:10px">Indeterminate </h4> <div layout = "row" layout-sm = "column" layout-align = "space-around"> <md-progress-linear md-mode = "indeterminate"></md-progress-circular> </div> <h4 style = "margin-top:10px">Buffer</h4> <div layout = "row" layout-sm = "column" layout-align = "space-around"> <md-progress-linear class = "md-warn" md-mode = "{{ctrl.modes[0]}}" value = "{{ctrl.determinateValue}}" md-buffer-value = "{{ctrl.determinateValue2}}"></md-progress-linear> </div> <hr ng-class = "{'visible' : ctrl.activated}"> <div id = "loaders" layout = "row" layout-align = "start center"> <p>Progress Buffer Indicators: </p> <h5>Off</h5> <md-switch ng-model = "ctrl.activated" ng-change = "ctrl.toggleActivation()" aria-label = "Toggle Buffer Progress Indicators"> <h5>On</h5> </md-switch> </div> </div> </body> </html>
结果
验证结果。