I have a top level controller as follows
.controller('body', function ($scope, $ionicPlatform, $ionicLoading, SQL) {
$ionicLoading.show({
template: 'Initializing...'
});
$ionicPlatform.ready(function () {
console.log('platform Ready!');
SQL.Init().then(function () {
console.log('DB Ready!');
$scope.initialized = true;
$ionicLoading.hide();
});
document.addEventListener("online", function () { console.log("online"); }, false);
document.addEventListener("offline", function () { console.log("offline"); }, false);
});
})
The problem I am having is that the online and offline events are not firing.
Did you add the network-information plugin? http://plugins.cordova.io/#/package/org.apache.cordova.network-information
Try using ngCordova network layer, it does this work for you http://ngcordova.com/docs/#Network