0
これは実装上の問題です。 私は何が間違っているのか分かりません。
var promises = items.map(function(item) {
return HttpWrapper.send(url, {"operation": 'GET'}).then(function(pricingOptions) {
item.selectedItem = pricingOptions[0];
item.selectedItem.zone = 'us-east-1a';
arr.push(item);
});
});
$q.all(promises).then(function(result) {
vm.selectedItems.server = arr;
しかし、問題がある...
それは最初に解決しに来...
item.selectedItem = pricingOptions[0];
item.selectedItem.zone = 'us-east-1a';
それは$q.all
右の内側にくるべきか?または、$q.all()
を完全に削除することはできますか?
私は間違っていますか?
なぜマップ関数の後に 'else'ステートメントがありますか?また、HttpWrapperはどのように見えますか? –
@LenilsondeCastro elseは不要で、HttpWrapperは$ httpとみなすことができます – StrugglingCoder
allPromiseに '$ q.all(約束).then(function(result){...} 'のようなエラーコールバックを追加することを検討してください。 ); 'あなたの約束の一つが解決されないかもしれないからです。 –