I have a collection that requires me to post multiple items in a for loop. Below is the code snippet:
for(i = 0; i < 28; i++) {
var request = $http({
method: "post",
url: "/students",
data: {
studentName: "Student",
answerImage: "image",
questionPrompt: 1
}
}).then(function successCallback(response) {
}, function errorCallback(response) {
console.log(response);
});
}
Despite trying several times, I am facing an issue where it only posts around 20-23 items out of the expected 28. The data fields seem fine, but I keep getting this error response in the console:
Object {data: null, status: -1, config: Object, statusText: ""}
I'm unsure about the next steps to take. In my actual application, I will need to post approximately 200 items like this. Could it be a timing out problem?
Thank you!