I want to create a stop watch. I googled and got a few tips on how to make a timer. Here is what I have done 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 displayed value in this format:
<label>{{value | date: 'hh:mm:ss'}}</label>
The problem is the clock always starts at 04:00:00 and when I call the startTimer()
function, it starts the timer okay but I want the timer to be like:
00:00:00
00:00:01
00:00:02
....
Can anyone tell me how to start timer at 00:00:00?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…