I want to create a stopwatch. I googled and got some tips on how to make a timer. Here is what I did in my controller:
$scope.value = 0;
$scope.startTimer = function() {
$scope.value = 0;
var change = function() {
$scope.value += 1000;
$timeout(change,1000);
};
$timeout(change, 1000);
}
And in my html display value in this format:
<label>{{value | date: 'hh:mm:ss'}}</label>
The problem is that the clock always starts at 04:00:00, and when I call the function startTimer(), it starts the timer in order, but I want the timer to be as follows:
00:00:00
00:00:01
00:00:02
....
Can someone tell me how to start a timer at 00:00:00?
source
share