Maintaining order of http requests within a for loop in javascript Maintaining order of http requests within a for loop in javascript mongoose mongoose

Maintaining order of http requests within a for loop in javascript


It's wasteful sending $scope.array.length number of HTTP requests when you have all the data you want to send ready.

Just post the whole array to your backend and then you can save them in a loop on the backend using something like async to guarantee the order.