Skip to content

Instantly share code, notes, and snippets.

@RajaJaganathan
Last active September 19, 2015 09:14
Show Gist options
  • Save RajaJaganathan/d5c105f3f1544186cb5a to your computer and use it in GitHub Desktop.
Save RajaJaganathan/d5c105f3f1544186cb5a to your computer and use it in GitHub Desktop.
AngularJS Setup load view/images poup when service call in progress
var app = angular.module('myApp',
['myApp.services', 'myApp.controllers']);
app.run(['$rootScope', function($root) {
$root.$on('$routeChangeStart', function(e, curr, prev) {
if (curr.$$route && curr.$$route.resolve) {
// Show a loading message until promises aren't resolved
$root.loadingView = true;
}
});
$root.$on('$routeChangeSuccess', function(e, curr, prev) {
// Hide loading message
$root.loadingView = false;
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment