Z
Z
ZNick19822014-09-04 09:59:04
JavaScript
ZNick1982, 2014-09-04 09:59:04

How to work from Angular with HTTP Batch requests for ASP.NET WebApi 2?

Good afternoon everyone.
I am developing a project on AngularJS + ASP.NET MVC 5 framework.
There was such a problem: When you change some element in the system, you need to update a large amount of various data, which results in a large number of requests to the server.
As an optimization, I think to use HTTP Batch requests.
I want to make an interface like this

$httpBatch.Send(batchUrl, function(){
      $http.get(url).success(function(){
//    ... some data assignments      
      });
     $http.post(url, data).success(function(){
//    ... some data assignments      
      });
})

The question is how do I when receiving a response from $httpBatch.Send do so that the promises that return $http.get, $http.post, etc. resolved with the relevant data?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-09-04
Protko @Fesor

return $q.all([promise1, promise2, promise3])
+ see ready-made solutions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question