Skip to content

Instantly share code, notes, and snippets.

@zhuangya
Forked from clouddueling/app.js
Created October 24, 2013 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhuangya/7139988 to your computer and use it in GitHub Desktop.
Save zhuangya/7139988 to your computer and use it in GitHub Desktop.
app.config(function($routeProvider, $httpProvider) {
var numLoadings = 0,
loadingScreen = $('.processing');
$httpProvider.interceptors.push(function() {
return {
request: function(config) {
++numLoadings;
loadingScreen.show();
return config;
},
response: function(response) {
--numLoadings;
if (numLoadings == 0)
loadingScreen.hide();
return response;
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment