You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 23, 2026. It is now read-only.
Hi,
I've not found a way to add a dynamic(scope) value in attr countdown.
Ex: or (This way throws error in parsing)
To fix this I changed the module directive adding the last line:
(countdown: '=', and it works)
I am also having this issue. I'm trying to put a scope variable into the countdown attribute and it fails with this error:
Error: [$parse:syntax] Syntax Error: Token 'selectedNotification.countdown' is unexpected, expecting [:] at column 3 of the expression [{{selectedNotification.countdown}}] starting at [selectedNotification.countdown}}].
My example hasn't been tested for countdown, but I'm pretty sure it will translate.
I don't think that adding countdown: '=' would be a good way to do things, as this is already set up with countdownattr: '=countdown', and it is countdownattr that does all the magic.
You just need to delay rendering the directive until the point in the $digest cycle when your variable has been evaluated with an ng-if.
Hope this helps.
EDIT:
More info on Angular's rendering cycle here: [ http://stackoverflow.com/questions/24615103/angular-directives-when-and-how-to-use-compile-controller-pre-link-and-post?rq=1 ]
Reacted by Moe Far, Julio Cesar and Wallace Goulart Gaudie Ley
Yes this was the reason. The variable was not set yet. I fixed it using a django template variable instead of a angular variable which was not always set.
Your method with ng-if sounds good too.
@FelixFortis I tried that before, but the problem with that is first off end-time doesn't work at all, second, the moment it is assigned it will start with whatever time that was last rendered, then takes about a sec to update to the current value, meaning you will get a 1 or 2 sec flash. So this is not optimal in my opinion.
Activity
Tasemu commentedon Jul 18, 2014
I am also having this issue. I'm trying to put a scope variable into the countdown attribute and it fails with this error:
Error: [$parse:syntax] Syntax Error: Token 'selectedNotification.countdown' is unexpected, expecting [:] at column 3 of the expression [{{selectedNotification.countdown}}] starting at [selectedNotification.countdown}}].
Tasemu commentedon Jul 18, 2014
However the fix doesn't appear to be working for me.
analuisamartins commentedon Jul 18, 2014
The fix works without the {{ }}
Ex:
countdown="timeLimit"
papasax commentedon Dec 3, 2014
Same issue, same fix. The fix works without the {{ }}.
Why don't you ask for a pull?
lukasz-kaniowski commentedon Dec 23, 2014
Ask for pull, please.
pencilcheck commentedon Dec 28, 2014
$scope.$broadcast 'timer-set-countdown', secs
This works.
FelixFortis commentedon Apr 16, 2015
Adding an
ng-ifworked for me, ensuring the variable was ready to go before the directive was rendered.So from:
To:
My example hasn't been tested for
countdown, but I'm pretty sure it will translate.I don't think that adding
countdown: '='would be a good way to do things, as this is already set up withcountdownattr: '=countdown', and it iscountdownattrthat does all the magic.You just need to delay rendering the directive until the point in the
$digestcycle when your variable has been evaluated with anng-if.Hope this helps.
EDIT:
More info on Angular's rendering cycle here: [ http://stackoverflow.com/questions/24615103/angular-directives-when-and-how-to-use-compile-controller-pre-link-and-post?rq=1 ]
papasax commentedon Apr 16, 2015
Yes this was the reason. The variable was not set yet. I fixed it using a django template variable instead of a angular variable which was not always set.
Your method with ng-if sounds good too.
pencilcheck commentedon Apr 18, 2015
@FelixFortis I tried that before, but the problem with that is first off end-time doesn't work at all, second, the moment it is assigned it will start with whatever time that was last rendered, then takes about a sec to update to the current value, meaning you will get a 1 or 2 sec flash. So this is not optimal in my opinion.
h3nr1ke commentedon Jan 29, 2016
+1 for ng-if solution....
wtczk commentedon Mar 7, 2016
works fine:
<timer ng-if="vm.countdown" countdown="vm.countdown"NaN:
<timer countdown="vm.countdown"+1 for ng-if solution
Miljokodiyan commentedon May 27, 2016
+1 for ng-if solution ..i tried many ways except ng-if...Wowww its worked perfectly
hdung912 commentedon May 18, 2017
👍 for @wtczk it work for me thanks you :)