There are times when I find myself waiting for a .forEach()
method to complete, especially in functions involving loaders. My current approach involves using the following code:
$q.when(array.forEach(function(item){
//perform iteration
})).then(function(){
//proceed with processing
});
However, I can't shake the feeling that there could be a better way to handle waiting for a .forEach()
loop to finish. What would be a more optimal solution for this scenario?