The problem here is that you don't know which request respond because you didn't isolate your context.
Let's explain:
var requestUrl=[url1,url2,url3,url4,url5];
for(var i=0;i<requestUrl.length;i++){
// Here you're making an async call to a URL
$http.get(requestUrl[i]).success(response){
// When the response arive, i=4, it appends after the loop is over
console.log(response);
};
}
To avoid this,there are 2 good practices:
-> Changing your loop to a "forEach'
var requestUrl=[url1,url2,url3,url4,url5];
requestUrl.forEach(function(url) {
$http.get(url).success(response){
console.log(url '+' response);
};
}
-> Keep a for loop but use a closure to keep the index, or the URL
var requestUrl=[url1,url2,url3,url4,url5];
for(var i=0;i<requestUrl.length;i++){
// Here you can keep "i" in "index"
(function(index) {
$http.get(requestUrl[i]).success(response){
console.log(requestUrl[index] + response);
};
})(i);
}