angularjs make a simple countdown

后端 未结 10 1542
别跟我提以往
别跟我提以往 2020-12-12 19:26

I would like make a countDown with Angular js. this is my code:

Html File

{{countDown}}
10条回答
  •  天涯浪人
    2020-12-12 20:00

    Please take a look at this example here. It is a simple example of a count up! Which I think you could easily modify to create a count down.

    http://jsfiddle.net/ganarajpr/LQGE2/

    JavaScript code:

    function AlbumCtrl($scope,$timeout) {
        $scope.counter = 0;
        $scope.onTimeout = function(){
            $scope.counter++;
            mytimeout = $timeout($scope.onTimeout,1000);
        }
        var mytimeout = $timeout($scope.onTimeout,1000);
    
        $scope.stop = function(){
            $timeout.cancel(mytimeout);
        }
    }
    

    HTML markup:

    
    
    
        
        
    
    
    
    {{counter}}

提交回复
热议问题