angular-timer icon indicating copy to clipboard operation
angular-timer copied to clipboard

How to get data binding to work with timer countdown?

Open asamuga opened this issue 9 years ago • 2 comments

So I create HTML with PHP like this: <timer countdown="vars['<?php echo $content->id ?>']" interval="1000">{{days}} day{{daysS}}, {{hours}} hour{{hoursS}}, {{minutes}} minute{{minutesS}}, {{seconds}} second{{secondsS}}.</timer> It looks like this when it compiles:

<timer countdown="vars['20037']" interval="1000"> ...

Then I set value in JS but data binding doesnt work. Its always 0.

Any suggestions?

Best Regards

asamuga avatar May 29 '16 23:05 asamuga

You could also use ng-if on your timer element to check for your countdown variable. This way, the directive will only be initialised when you have your date, and it will work. Original answer here: https://github.com/siddii/angular-timer/issues/36

ahmedkhaledmohamed avatar Jun 03 '16 09:06 ahmedkhaledmohamed

After read all the related problems about this databinding issue, for some reason, still having this problem.

Using the ng-if to check the countdown variable works when you set the countdown for the first time, but it don't show de right value if I try to set this value to the variable again.

I've tried too to add the value to the existent countdown variable, but still doesn't work.

How can I set again the variable value or add to the existent countdown this value in the right way?

TioDraco avatar Jul 25 '16 19:07 TioDraco