How to count down in angularjs with timer directive

I am trying to make a simple countdown using the angularJS timer directive. I want to count days, hours, minutes and seconds to 0 with an interval of 1 second.

With a link to the site: a timer with angled arrows

I tried this solution:

<timer interval="1000" countdown="1357020000000"> >{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds</timer> 

in which the first parameter indicates the โ€œgraininessโ€ of the countdown, which is 1 second (1000 ms), and the second parameter indicates the starting point of the countdown in accordance with the examples described in the link, but does not produce the output that I want, because it starts from: 15706249 days 23 hours 53 minutes.

+4
source share
1 answer

It seems like the timer directive takes the countdown value in seconds, but you gave it in milliseconds. Try using the value 1357020000 instead of 1357020000000 as the value.

+1
source

Source: https://habr.com/ru/post/1502480/


All Articles