All Components

ProgressBar / AngularJS

{{status}}

HTML5/JavaScript 源码

<!DOCTYPE html>
<html>
 <head> 
  <title>AngularJS</title> 
  <meta charset="utf-8"> 
  <link href="../content/shared/styles/examples-offline.css" rel="stylesheet"> 
  <link href="../../styles/kendo.common.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.rtl.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.default.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet"> 
  <script src="../../js/jquery.min.js"></script> 
  <script src="../../js/angular.min.js"></script> 
  <script src="../../js/kendo.all.min.js"></script> 
  <script src="../content/shared/js/console.js"></script> 
  <script>
        
    </script> 
 </head> 
 <body> 
  <a class="offline-button" href="../index.html">Back</a> 
  <div id="example" ng-app="KendoDemos"> 
   <div class="demo-section k-content" ng-controller="MyCtrl"> 
    <h4>{{status}}</h4> 
    <div kendo-progress-bar="progressBar" k-min="0" k-max="100" ng-model="progress" style="width: 100%;"></div> 
   </div> 
  </div> 
  <script>
  angular.module("KendoDemos", [ "kendo.directives" ])
      .controller("MyCtrl", function($scope, $timeout){
          $scope.status = "Working...";
          $scope.progress = 0;
          $scope.labels = [
            "Installing start menu items",
            "Registering components",
            "Having a coffee"
          ];
          var i = -1;
          function update() {
            $scope.progress += random(0, 10);
            if ($scope.progress > random(70, 90)) {
              $scope.progress = random(5, 50);
              i = (i + 1) % $scope.labels.length;
              $scope.status = $scope.labels[i];
            }
            $timeout(update, 200);
          }
          function random(a, b) {
            return a + Math.floor(Math.random() * (b - a));
          }
          update();
  })
</script>   
 </body>
</html>