2016-08-05 48 views

回答

0

經過長時間的搜索..我試圖用我的跟蹤HTML進度欄。

我們可以根據您的送貨狀態更新進度值。 現在我已經使用$interval更新每三秒的進度。

var app = angular.module("progress_app", []); 
 
\t app.controller('testCtrl',function($scope, $interval){ 
 
\t $scope.progress_value=5; 
 

 
\t $scope.heading="Shipping Tracker"; 
 
    $scope.callAtInterval = function() { 
 
     if($scope.progress_value <=100){ 
 
\t \t $scope.progress_value = $scope.progress_value * 2; 
 
\t }else{ 
 
\t \t $scope.progress_value = 5; 
 
\t } 
 
\t  
 
    } 
 

 
    $interval(function(){ $scope.callAtInterval(); }, 3000); 
 
\t });
.tracker { 
 
\t \t width:80% 
 
\t }
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> 
 
</head> 
 
<body ng-app="progress_app" ng-controller="testCtrl"> 
 
\t \t <h3 ng-bind='heading'> </h3><br/><br/> 
 
\t \t <progress value="{{progress_value}}" max="100" class="tracker"> 
 
\t \t </progress> 
 
</body> 
 
</html>

相關問題