Access hours and minutes with Angular Timer

Asked

Viewed 262 times

2

I want to take the data of hours and minutes from the Angular Timer and play in a variable to save in the bank, as I do?

1 answer

4


Interrupt the Timer with a broadcast:

$scope.$broadcast('timer-stop');

At the same time, monitor the event timer-stopped, and capture the object containing the timer state:

$scope.$on('timer-stopped', function (event, data){
    console.log(data);
});

The object will contain the following properties:

days
hours
Millis
minutes
Seconds
timeoutId

  • It worked, but using ng-click I have to run twice to display on the console and assign in another variable. Could there be a problem with ng-click or asynchrony? Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.