I have been working on a phonegap 3.3 application that incorporates angularjs. When testing the application in my browser, I am successfully able to detect and respond to 'offline' and 'online' events. However, when I switch to the ios (7) simulator, I am noticing some unexpected event sequences. For example:
When I disable wi-fi, the console logs:
var app = angular.module('test', []);
app.run(function($window, $rootScope) {
$rootScope.online = navigator.onLine;
$window.addEventListener("offline", function () {
console.log("OFFLINE EVENT");
$rootScope.$apply(function() {
$rootScope.online = false;
});
}, false);
$window.addEventListener("online", function () {
console.log("ONLINE EVENT");
$rootScope.$apply(function() {
$rootScope.online = true;
});
}, false);
});