1

I am trying to do multiple $http post call and my code looks something like this:

var data = [{"id": 1, "Name": A}, {"id": 2, "Name": B},...];
var requests = [];
angular.forEach(data, function(value) {
    requests.push($http(
       url:'/example.com', 
       method: "POST", 
       dataType: 'json', 
       contentType:'application/json', 
       data:value ))
    });
$q.all(requests).then(function(results){
    results.forEach(function(data,status,headers,config){
        console.log('success');
    })
})

This works fine, but when the length of data array is more the number of service calls from client side is high. So I would like to make it as a batch request. Am not able to find any proper documentation for batch request for POST operation. Kindly help me on this.

selladurai
  • 6,491
  • 14
  • 56
  • 88
Prabhakaran
  • 1,524
  • 2
  • 13
  • 21

0 Answers0