4
votes

I'm trying to do a simple countdown with the timer directive of angularJS. I want to count down days, hours, minute and seconds to 0 with an interval of 1 second.

With a reference to the site : timer with angularjs

I've tried this solution:

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

in which the first parameter indicates "granularity" of the countdown which is of 1 second (1000 ms) and the second parameter indicates the start point of the countdown according to the examples which are described in the link, but doesn't produce the output I want because it starts from: 15706249 days 23 hours 53 minutes.

1
ok i've resolve, pratically the countdown attribute which indicates the begin od the countdown must be expressed in seconds and not in milliseconds. - josè
can i use this for years also? - Paresh Gami

1 Answers

1
votes

It would appear that the timer directive takes the countdown value in seconds but you have given it in milliseconds. Try using 1357020000 instead of 1357020000000 as the value.