Does AngularJS help out in any way when it comes to have a duration counter on my web page? -
Does AngularJS help out in any way when it comes to have a duration counter on my web page? -
i have application uses angular ui-router. when router set state have timer set illustration 2 hours. while set state have counter count down. have time remaining display on screen.
does have code illustration on how go implementing functionality? if has done similar appreciate advice give.
i using countdown service purpose in project. per requirement can utilize service below :
start init on first page
app.controller('view1ctrl', function($scope, $cscountdown){ $cscountdown.init(2 * 3600); // 2 hours $scope.countdown = $cscountdown.data; })
start counter on sec page
app.controller('view2ctrl', function($scope, $cscountdown){ $cscountdown.start(); $scope.countdown = $cscountdown.data; })
you can display value on page using countdown.stringvalue
<h1>time : {{countdown.stringvalue}}</h1>
you can see working plunker link. have created view1 & view2 transition animation.
edit
i have update plunker 2 have practical example.
initially see instruction page, timer initialized 2 hours.
then move questions 1, timer starts
from question 1 can go help page, timer pauses
then move question 2, timer resumes...
angularjs
Comments
Post a Comment