Hello everyone,

I have an array of addresses that I call with $http from my controller:

vm.checkStatus = function() {
for(var i=0; i < vm.serverList.length; i++){ 
monitorService.getStatus( vm.serverList[i]).then(function(response){
vm.serverList[i].receivedStatus = response;
});
}
}

and the Service:

function getStatus(config) {
return $http(config).
success(function(data, status, headers, config) {
         console.log("status for",config.url,status);
         return status;
    }).
error(function(data, status, headers, config) {
         console.log("status for",config.url,status);
         return status;
    });

My problem is around the order of resolving promises, for example if my 
serverList has a length of 3 items, the first resolved response is assigned 
like this : vm.serverList[2].receivedStatus = response;

How can I keep track of the calls and assign the right response to the 
right item inside the serverList array ?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to