@iamsim wrote:
Calling cordova network plugin inside interceptor which is inside the config( function(){} ) is failing and it says - "undefined is not an object" for window.plugin.network.type
device - iPad
$httpProvider.interceptors.push(function($rootScope, $cordovaNetwork) {
return {
request: function(config) {
if ($cordovaNetwork.isOnline()) {
$rootScope.$broadcast('loading:show');
return config;
}
},
response: function(response) {
$rootScope.$broadcast('loading:hide');
return response;
},
responseError: function(rejection) {
$rootScope.$broadcast('loading:hide');
return rejection;
}
}
})
Posts: 1
Participants: 1