Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   function fakeTimer() {
  2.     $scope.progress = {
  3.     time: 30,
  4.     pecent: 0
  5.     }
  6.     var total_time = progress.time;
  7.     if (progress.time > 0) {
  8.     var timer = setInterval(function () {
  9.       if (progress.time > 0) {
  10.         $scope.progress.time--
  11.         $scope.progress.pecent = 100 / total_time * $scope.progress.time;
  12.         $scope.$apply();
  13.       } else{
  14.         clearInterval(timer)
  15.       }
  16.     }, 1000);
  17.   }
  18.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement