Here is my code to add a progress bar on every HTTP request. Can someone please point out to me whether I am doing it right or not?
Template for loader:
<div class="loader" ng-class="!loaderState ? 'hidden' : ''">
<div class="parentLoader">
<div class="loaderContainer">
<div class="logo"></div>
<div class="loadingMsg">Processing..., Please Wait...</div>
<div class="loadingImg"></div>
</div>
</div>
</div>
Interceptor:
.factory('authInterceptor', ['$rootScope', function($rootScope){
return {
request : function request (config) {
$rootScope.loaderState = true;
return config;
},
response : function response(response) {
$rootScope.loaderState = false;
return response;
}
};
}])