What's the difference? When should I use which? I am new to Angular & they look very similar to me. I would rather follow best practices from the start.
$interval executes a callback repeatedly, while $timeout simply delays the execution of a callback (doesn't repeat). So, no, they're not the same. Additionally, it should be noted that both of them are wrappers for window.setInterval and window.setTimeout respectively.
$interval
$timeout
window.setInterval
window.setTimeout
I would also like to recommend to read this great article written by John Resig on how Javascript timers work.
1.4m articles
1.4m replys
5 comments
57.0k users