In my Angular.js application, I run some asynchronous operation. Before starting, I cover the application with a modal div, and then, once the operation is complete, I need to remove the div whether the operation was successful or not.
I currently have this:
LoadingOverlay.start(); Auth.initialize().then(function() { LoadingOverlay.stop(); }, function() { LoadingOverlay.stop();
It works well, however I would prefer to have something cleaner like this pseudo code:
LoadingOverlay.start(); Auth.initialize().finally(function() {
I assume this is a fairly common problem, so I thought it could be done, but could not find anything in the document. Any idea if this can be done?
javascript angularjs promise deferred finally
this.lau_ Apr 16 '13 at 14:52 2013-04-16 14:52
source share