So Here is a plunker. I've taken your example. And made a few changes. I use $timeout
to replicate $http
and because of this you can uses angular promises. (the .then
) after the code in that is executed a digest cycle is run. And since the references ($scope.selectedAccounts
) have changed the ng-repeat
s refresh those that have changed. Its very easy to use $http
with promises to update the view.
In the plunk,
You'll notice that only the successfullyActivatedAccounts
actually activate because they were the only ones that successfully returned (dummy data). Also the loop in activateAccounts
can be optimized if you know a for sure the ordering of the return value. But overall the performance of this should be fine.
I updated the data set to be as large as plunker could handle. Activating performance is still pretty instant.