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

后端 未结 7 1623
生来不讨喜
生来不讨喜 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:39

    Here is a small answer to it. In this fiddle you can see how it works, if an error occurs in some promise.

    $q.all([test1(), test2()]).then(function() {
      // success
    }, function() {
      // error
    });
    

    http://jsfiddle.net/wd9w0ja4/

提交回复
热议问题