Also in a .config()
But I don't use a plugin like $cordova network in the http intercept
But I was thinking .. why don't you just skip the online check in your http intercept. so like
$httpProvider.interceptors.push(function($rootScope) {
return {
request: function(config) {
$rootScope.$broadcast('loading:show');
return config;
},
response: function(response) {
$rootScope.$broadcast('loading:hide');
return response;
},
responseError: function(rejection) {
$rootScope.$broadcast('loading:hide');
return rejection;
}
}
})
So it always try and make the intercept and show the loading and if something goes wrong (for instance no network) it always close the loading.