This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Provide an overload for $timeout that doesn't take a function #9176
Closed
Description
I propose a $timeout
variant that takes only a duration parameter.
There are two primary use cases I can think of
It would be really nice to be able to do:
$timeout(100).then(function(){
// do stuff here, this runs a digest if it needs to which the
// $timeout(function()... variant does not since 19b6b34
})
As well as
myServiceFn().then(function(res){
// do something
return $timeout(300);
}).then(function(){...
Which is rather common and today is accomplished by return $timeout(angular.noop, 300)
which feels redundant and rather ugly.
This could be accomplished by adding a simple check here and I wouldn't mind creating a PR if you would entertain one.