Instead of the default setTimeout function, you should use the AngularJS wrapper service $timeout *
Rule based on Angular 1.x
Styleguide Reference
The following patterns are considered problems;
/*eslint angular/timeout-service: 2*/
// invalid
setTimeout(function() {
// ...
}, 1000) // error: You should use the $timeout service instead of the default window.setTimeout method
// invalid
window.setTimeout(function() {
// ...
}, 1000) // error: You should use the $timeout service instead of the default window.setTimeout method
// invalid
$window.setTimeout(function() {
// ...
}, 1000) // error: You should use the $timeout service instead of the default window.setTimeout method
The following patterns are not considered problems;
/*eslint angular/timeout-service: 2*/
// valid
$timeout(function() {
// ...
}, 1000)
This rule was introduced in eslint-plugin-angular 0.1.0