Created
October 15, 2015 16:22
-
-
Save neufeldtech/0187c251b28f98f98c25 to your computer and use it in GitHub Desktop.
Looping through http calls in angular controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (var i = 1; i < 6; i++) { // 6 is just a given number, it could be 1 or 100.... | |
(function(i){ | |
http({method: 'POST', url: '/path/to/rest/friend', data: {"name":"Auto Friend " + i}}) | |
.then(function (response) { | |
console.log("friend created"); | |
console.log(response); | |
}, function () { | |
console.log('Whoops...'); | |
}); | |
})(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment