Angular: Why Should You Care About $destroy when $timeout

29 בOctober 2014

$timeout is a service that is used to invoke a function after a given amount of time. For example, invoking an alert("hello world") call after 1000 milliseconds would look as following: $timeout – when will it stop? But, have you ever consider what happens with the timeout call when you leave the page your in? Let's say the user clicks on a link and moves into a different ng-view that has a new controller. Will the $timeout call still be fire, calling your function unexpectedly even after the user has left the page? It seems the $timeout call will still be invoked, even...
tags: ,
no comments