dynamically bind start time
how do i dynamically bind $scope variable to start-time attribute as a value
My HTML Code: [div id="timer" class="container-fluid pad0 {{disTimer}}" ng-if="page !='init'"] [div class="timerBlock"] [strong][timer autostart="false" start-time="{{startTimerVal}}"]{{minutes}}:{{seconds}}[/timer][/strong] mins over [/div] [/div] Note: square brackets are actually greater than / less than sign My JS Code :
$scope.startTimerVal = ($scope.startHour_360000)+($scope.startMin_60000)+($scope.startSec*1000);
In startTimerVal I get dynamic value where I convert that value into miliseconds
Using this I get below error
Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 2 of the expression [{{startTimerVal}}] starting at [{startTimerVal}}].
+1
@beinguideveloper put it directly, it still isn't working correctly for me but at least I don't get the error:
<timer interval="1000" start-time="stopwatch.sw.total"...
$scope.startHour=0;
$scope.startMin=0;
$scope.startSec=0;
$scope.time_start =Date.now()-(($scope.startHour*3600000)+($scope.startMin*60000)+($scope.startSec*1000));
in HTML:
You can set your start ticking time through make change of setHour, setMin, setSec.
Ok, I found the fix on another issue:
https://github.com/siddii/angular-timer/issues/177
You can try ng-if. After you load the time using Ajax, set ng-if condition to true, the timer will run after the promise resolve in ng-if.
same here !