Here is the code i have inject all the necessary dependencies in angular controller.I have shown only main part on which i am confuse.
$scope.ipList=["http://www.google.com",
"http://www.yahoo.com",
"http://hello",
"http://www.facebook.com",
"http://hi",
"http://bye"
];
for(var i=0;i<$scope.ipList.length;i++)
{
console.log(i); //1st console
$http.get($scope.ipList[i])
.then(function(response) {
console.log(i);
});
}
when i am executing this then 1st console is printing right result i.e.
0,1,2,3,4,5 but the 2nd console is printing only 5.
I want to execute $http.get() part every time with loop.So what should i do.