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

dynamically bind start time

Open beinguideveloper opened this issue 10 years ago • 6 comments

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}}].

beinguideveloper avatar Jun 11 '15 10:06 beinguideveloper

+1

joebordes avatar Jun 15 '15 19:06 joebordes

@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"...

joebordes avatar Jun 15 '15 20:06 joebordes

        $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: {{hours}}:{{minutes}}:{{seconds}}.

You can set your start ticking time through make change of setHour, setMin, setSec.

seaskymonster avatar Jul 29 '15 23:07 seaskymonster

Ok, I found the fix on another issue:

https://github.com/siddii/angular-timer/issues/177

chriseckman avatar Aug 18 '15 23:08 chriseckman

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.

idf avatar Dec 31 '15 07:12 idf

same here !

ghost avatar Mar 08 '17 10:03 ghost