即使其中一个请求失败,是否可以继续forkjoin http.get请求.
我期待在angular2中使用$ q.allSettled的类似功能.
参见示例:http://jsfiddle.net/Zenuka/pHEf9/
angular.module('qAllSettled', []).config(function($provide) {
$provide.decorator('$q', function($delegate) {
var $q = $delegate;
$q.allSettled = function(promises) {
return $q.all(promises.map(function(promise) {
return promise.then(function(value) {
return { state: 'fulfilled', value: value };
}, function(reason) {
return { state: 'rejected', reason: reason };
});
}));
};
return $q;
});
});
Run Code Online (Sandbox Code Playgroud)
KAB