Events not firing


#1

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. I feel like there must be some more Ionic way but I am very new to framework.