When I loose net connection and try to load a HTML template(which is not loaded previously) using angularJS it gives me error, net::ERR_INTERNET_DISCONNECTED.
Is there any way to call a function before angular fires error net::ERR_INTERNET_DISCONNECTED , so I will be able to notify user they have lost their connection.
I don't want to put watchers on online/offline status since I want user to be able to see previously loaded HTML templates.
From angularjs docs
angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {
return function(exception, cause) {
exception.message += ' (caused by "' + cause + '")';
throw exception;
};
});
Use this to catch every exception, including internet connection problems, it all runs through this method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With