angular timer directive not working with ionic framework

前端 未结 5 1522
情书的邮戳
情书的邮戳 2021-01-17 17:13

I am having issues with implementing the angular timer directive with the ionic framework. http://siddii.github.io/angular-timer/

When I implement the code using bow

5条回答
  •  醉话见心
    2021-01-17 18:02

    as per your comments, I am providing another answer... the stopwatch factory, that I am using in my project. as per your requirement you can use service like below :

    checkout the PLUNKER to have a practical example.

    1. Initially you see instruction page, where timer is initialized to 2 hours.

    2. Then move to questions 1, where timer starts

    3. from question 1 you can go to help page, where the timer pauses

    4. then you move back to question 2, where timer resumes...

    on how to use :

    1. start init it on first page

      app.controller('view1Ctrl', function($scope, $csCountdown){
        $csCountdown.init(2 * 3600); // 2 hours
        $scope.countdown = $csCountdown.data;
      })
      
    2. start the counter on second page

      app.controller('view2Ctrl', function($scope, $csCountdown){
        $csCountdown.start();
        $scope.countdown = $csCountdown.data;
      })
      

    you can display the value on any page using countdown.stringValue

    Time : {{countdown.stringValue}}

提交回复
热议问题