Checking internet connection before load firebase


#1

Hello!
I’m developing an app with Ionic1, AngularJS and Firebase as backend.
I have to check if the phone has internet connection before load all the Firebase scripts, if not, the app doesn’t work.

I thought that checking with this was enough, but I was wrong:

if(window.Connection) {
      if(navigator.connection.type == Connection.NONE) {
}}

I guess that its because Firebase is being imported anyway in the app here:
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services' , 'firebase'])

Is there any way to load ALL the components of Firebase once I am sure that the device has connection?

Thanks very much,
Regards, Nacho.