Reputation: 55729
Does function c
get invoked before the promise returned from b
is resolved?
function a() {
var d = $q.defer();
setTimeout(function() { d.resolve(); }, 10000);
return d.promise;
}
function b() {
var d = $q.defer();
setTimeout(function() { d.resolve(); }, 10000);
return d.promise;
}
function c() {
var d = $q.defer();
setTimeout(function() { d.resolve(); }, 10000);
return d.promise;
}
a().then(b).then(c);
Upvotes: 1
Views: 157
Reputation: 7214
It doesn't. If a function provided to Promise.then
(which returns promise A
) returns a Promise
(promise B
), A
waits on B
to be resolved before resolving itself. (See documentation.)
Upvotes: 0