I have list of ids [1,2,3,4], I need to make update with this ids and with the answer from my update I need to make UI update to displayed list. I must update each row in my list async, once one id update finished I will make UI update for this row
my approach is to make for loop and to make $http request for each id
for(var i = 0 ; i < ids.length; i++){
$http.get("api/update?Id=" + ids[i]).then(function (result) {
$scope.nodeUpdate = result;
});
}
$scope.$watch('nodeUpdate', function() {
//update node result, the result will have node id+new data
});
What do you think? This should work fine? Is there a better way to do it?
Thanks,