1
私はすべての約束を同時に実行しようとしているので、解決するときに何かできることがあります。約束が拒否されていますが、 '$ q.all()'が解決します。私はいくつかの '$ q.all'の行為を見逃していますか?
ありがとうございます!
try {
throw Error();
} catch (e) {
console.log("Error", e);
}
console.log("This log also happens");
それは約束と同じです::
Promise.reject(Error())
.catch(e => console.log("Error", e))
.then(() => console.log("This log also happens"));
それが処理されます - あなたcatch
エラーと、それを再スローしていないのtry catchブロックで
function saveOrder() {
return ordersSrv.saveOrder(order).then(function(data) {
console.log('saveOrder OK');
},
function(error) {
console.log('saveOrder KO');
});
}
var aPromises = [saveOrder()];
$q.all(aPromises).then(function() {
console.log('OK');
},
function (error) {
console.log('---> error');
});