Ответ 1
Используйте $q.all()
$q.all([promise1, promise2]).then(function (result) {
// result should be an array
}, function () {
// call when either promise1 or promise 2 is rejected
});
Как присоединиться 2+ promises в angular?
(Я видел документацию chain, но это не то, что мне нужно)
Пример того, чего я хочу достичь в Q:
Q.all([promiseA, promiseB]).done(function () {
console.log("Both promises have been executed concurrently and then resolved");
});
Используйте $q.all()
$q.all([promise1, promise2]).then(function (result) {
// result should be an array
}, function () {
// call when either promise1 or promise 2 is rejected
});