2

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() {
        $timeout.cancel(delay);
      });
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233

1 Answers1

5

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

Calling cancel on it does nothing.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335