No connection - IOS - Ionic1

I work on a Ionic Application and I’ve a problem when my app has no connection.

This code works when the app is already open and lost connection to the Internet. But when I open the app with no connection already, it doesn’t work (just shows a blank screen after splashscreen):

 $ionicPlatform.ready(function() {
var type = $cordovaNetwork.getNetwork()
var isOnline = $cordovaNetwork.isOnline()
var isOffline = $cordovaNetwork.isOffline()

// listen for Online event
$rootScope.$on('$cordovaNetwork:online', function(event, networkState){
  var onlineState = networkState;

// listen for Offline event
$rootScope.$on('$cordovaNetwork:offline', function(event, networkState){
  var offlineState = networkState;
  title: "Pas d'accès à Internet!", 
  content: "Votre smartphone ne semble pas être connecté à Internet. Vous ne pouvez pas profiter de vos boissons offertes."


Any clue to resolve this issue?