-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Provide an overload for $timeout that doesn't take a function #9176
Comments
This looks reasonable |
According to @caitp (#9175 (comment)) If that is indeed the case, then I don't see this change making any difference. |
yes, I'm going to see if I can reproduce what they're talking about, because this was tested manually before |
http://jsbin.com/tesaqovopaza/1/edit can't reproduce at all |
Wait hang on, these things are talking about two very different issues ^_^ |
@caitp: I.e. everything that will be possible using |
yeah, I sort of agree that it's a weird feature to add, but if people really want it, it probably won't account for much code |
@caitp here is a fiddle illustrating it working after a After a second check this is not the breaking change since promises returning promises don't schedule a digest at the current moment anyway (although that's not the behavior I'd expect). I'm still all for this feature though for the promise chain use case regardless of this. I'll close the PR on the other issue, my bad. |
http://jsfiddle.net/3n9akpdg/ --- works this way. It looks like something is wrong with the way we're dealing with external promises, you should file a bug on $q |
@caitp it's not a bug since the digest system is completely orthogonal to the concerns of the Promises/A+ specification. Looking back at how $q behaves in 1.2 this is not a change. The overload is still nice for the promise chain case. I'll write a PR for this in the next few days and accompanying tests. |
Provide an overload for $timeout that doesn't take a function. Closes angular#9176
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:
As well as
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.
The text was updated successfully, but these errors were encountered: