.ready method is not working


#1

Hi,
I am new to ionic, and i have killed so many time. Still not getting why ready( ) method is not working. I was working to check the internet connectivity.Please help and thanks in advance. :slight_smile:

code:

angular.module(‘starter’, [‘ionic’, ‘starter.controllers’, ‘starter.services’])

.run(function($ionicPlatform,$ionicPopup) {

$ionicPlatform.ready(function() {

if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
  alert("keyboard");
  cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
  cordova.plugins.Keyboard.disableScroll(true);

}

if (window.StatusBar) {
  StatusBar.styleDefault();
}

if(window.Connection) {
  alert("Connection Check ");
           if(navigator.connection.type == Connection.NONE) {
               $ionicPopup.confirm({
                   title: "Internet Disconnected",
                   content: "The internet is disconnected on your device."
               })
               .then(function(result) {
                   if(!result) {
                       ionic.Platform.exitApp();
                   }
               });
           }
       }

});
})