gpt4 book ai didi

javascript - Angular promise 的解析顺序是否与发送的顺序相同?

转载 作者:行者123 更新时间:2023-11-28 18:25:01 26 4
gpt4 key购买 nike

我有一系列 $http.get 的 promise 。我想知道这些 promise 是否应按照推送到数组的顺序来解决。例如:

samplepromises.push($http.get(sampleurl, {responseType: 'blob'}));
...
...
$q.all(samplepromises).then(function(promisearr) {

});

最佳答案

是的。来自 the documentation :

Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value

关于javascript - Angular promise 的解析顺序是否与发送的顺序相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39329880/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com