Matthew Harwood February 2016

Does canceling a $timeout in the following 'then' function work?

I do this kind of all the time and I'm not too sure it works. If it does, How can I check? If it doesn't whats a better method of canceling a timeout after it's completed?

var delay = $timeout(function() {
      for (i = 0; i < allHighlightedEls.length; i += 1) {
       //... some transformations
    }, 1000)
      .then(function() {


Quentin February 2016

After it is completed, it is completed. There is nothing left to cancel.

Calling cancel on it does nothing.

Post Status

Asked in February 2016
Viewed 2,778 times
Voted 10
Answered 1 times


Leave an answer