var values=[a,b,c,d]; angular.forEach(values,function(value,key){ console.log('loop '+value+'Started'); var status=loading; console.log('loading',value); someAsyncMethod().then(function(status){ console.log('status of '+value + 'is '+status); // loop doesn't wait for this code to complete },function(error){ console.log('error occured for value'+ error); }) console.log('loop '+value+'ended'); // jumps to this code directly and continues the loop })
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)