Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: Automatic Counter with $interval

  • $interval
  • setInterval

Implement an automatic counter using the $interval service

The $interval service of Angular will run its callback every N miliseconds so we don’t have to re-schedule it every time, on the other hand we will have to call the cancel method to stop it when the user clicks on the stop button.