What happens with $q.all() when some calls work and others fail?

后端 未结 7 1627
生来不讨喜
生来不讨喜 2020-11-30 03:09

What happens with $q.all() when some calls work and others fail?

I have the following code:

    var entityIdColumn = $scope.entityType.toLowerCase()          


        
7条回答
  •  伪装坚强ぢ
    2020-11-30 03:17

    I believe since the promise library is based on Q implementation, as soon as the first promise gets rejected, the reject callback is called with the error. It does not wait for other promises to resolved. See documentation of Q https://github.com/kriskowal/q. For Q.all this is what is mentioned

    The all function returns a promise for an array of values. When this promise is fulfilled, the array contains the fulfillment values of the original promises, in the same order as those promises. If one of the given promises is rejected, the returned promise is immediately rejected, not waiting for the rest of the batch.

提交回复
热议问题