I would like to send post requests in loop. If i send for example 2 requests in a row only the last request really made the callback.
What am i do wrong?
Its clearly a closure issue. Read more here
Also it's suggested using $resource over $http. (ng-resource).
Check out the example to post in for loop using resource.
for(var i=0; i<$scope.ListOfRecordsToPost.length; i++){
var postSuccessCallback = function(postRec) {
console.info('Posted ' + postRec);
}($scope.ListOfRecordsToPost[i]);
lsProductionService.post({}, postSuccessCallback);
}