When working with AngularJS, how can one ensure that code is executed only after a change to a watched property has fully taken effect in the UI?
For instance, imagine that the visibility of a loading indicator is tied to the value of an isLoading
property on a model. How can it be ensured that subsequent functionality is triggered only after the loading indicator has become visible?
For example:
my-template.html
<my-loading-indicator ng-show="model.isLoading"></my-loading-indicator>
my-controller.js
// ...
MyController.prototype.doSomething = function() {
this.model.isLoading = true;
// How can I make sure that the UI is displaying the loading indicator before further actions?
}