How to get data binding to work with timer countdown?
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
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
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?