How $timeout works in angularJs? And how it's different from setTimeOut()?
2 Answers
$timeout run a function after a defined delay :
$timeout(yourFunction, yourDelayInMS)
For sample display an alert after one second:
$timeout(function(){alert('hello'},1000);
The difference between $timeout against setTimeout is $timeout is a part of the digest cycle of angularjs. if you modify the scope in your code it's better to use $timout instead of setTimeout.