0

I use the tutorial from http://codepen.io/jhasselkus/pen/Efaxw to create a stopwatch.

The stopwatch displays the action in milliseconds.

In my case I only need seconds or minutes.

I thought update-interval which is used should be in the beginning.

.controller('MainCtrl', function($scope, $interval) {
  $scope.version = angular.version.full;
  // The main controller maintains the current time for all stopwatch instances.
  $scope.sharedTime = new Date();
  $interval(function() {
    $scope.sharedTime = new Date();
  }, 500);
})

The update interval is here 500 ms.

I changed it to 10000 or to 50000 but nothing changed on the website. What is need to be changed to display the timer in minutes or seconds? And why the change of the value "500" doesn't affect anything?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Piet
  • 395
  • 2
  • 7
  • 17
  • so you want to show whole time object after every `500` seconds ? – Mudasser Ajaz Aug 31 '15 at 20:40
  • The stopwatch shows milliseconds. I only want to show it in minutes or seconds. At first I want to understand the whole code. – Piet Aug 31 '15 at 20:43
  • Please check controller part of this answer, that is more easy to understand http://stackoverflow.com/questions/32285679/angularjs-how-to-make-a-stop-watch-starting-from-000000-format/32285912#32285912 – Mudasser Ajaz Aug 31 '15 at 20:48
  • thanks for the answer, its a good start but it is very different from my example-code, so many changes needs to be done. (for example everytime it resetted on click on start) – Piet Sep 01 '15 at 21:16

0 Answers0