In my Angular (with Ionic) app, I have this code snippet:
my_app.factory('connectivityInterceptorService', ['$q', '$rootScope', function ($q, $rootScope) {
var connectivityInterceptorServiceFactory = {};
var _request = function (config) {
if(navigator.connection) {
if(navigator.connection.type == Connection.NONE) {
}
}
return config;
};
connectivityInterceptorServiceFactory.request = _request;
return connectivityInterceptorServiceFactory;
}])
The navigator.connection method retrieves the type of connection (wifi, 3G, none, etc...) using a Cordova plugin. This code effectively determines whether the device has an active connection. However, my goal is to "cancel" the request within this if statement, and I'm unsure if it's feasible.