When using AngularJS's $timeout, what's the default delay?
When $timeout
delay is omitted, it defaults to 0
. However, the block of code contained in it is executed after the DOM has been manipulated by Angular. See response to AngularJS $evalAsync vs $timeout
My understanding is that a delay of '0' means that it will be picked-up as part of the next run of the event loop. That's an especially short but indeterminate amount of time.
It's immediately executed, the default would be zero. Here is a jsfiddle showing it:http://jsfiddle.net/dgarlitt/rqs3p/1/
angular .module('myApp',[]) .controller('MyCtrl', function($scope, $timeout) { $timeout(function() { $scope.name = 'World'; }); });