// install   :      cordova plugin add org.apache.cordova.network-information
// link      :      https://github.com/apache/cordova-plugin-network-information/blob/master/doc/index.md

angular.module('ngCordova.plugins.network', [])

  .factory('$cordovaNetwork', ['$rootScope', '$document', function ($rootScope, $document) {

    return {
      getNetwork: function () {
        return navigator.connection.type;
      },

      isOnline: function () {
        var networkState = navigator.connection.type;
        return networkState !== Connection.UNKNOWN && networkState !== Connection.NONE;
      },

      isOffline: function () {
        var networkState = navigator.connection.type;
        return networkState === Connection.UNKNOWN || networkState === Connection.NONE;
      },

      watchOffline: function () {
        $document.addEventListener("offline", function () {
          var networkState = navigator.connection.type;
          $rootScope.$apply(function () {
            $rootScope.$broadcast('networkOffline', networkState);
          });
        }, false);
      },

      watchOnline: function () {
        $document.addEventListener("online", function () {
          var networkState = navigator.connection.type;
          $rootScope.$apply(function () {
            $rootScope.$broadcast('networkOnline', networkState);
          });
        }, false);
      },

      clearOfflineWatch: function () {
        $document.removeEventListener("offline", function () {
          $rootScope.$$listeners.networkOffline = []; // not clearing watch --broken clear
        }, false)
      },

      clearOnlineWatch: function () {
        $document.removeEventListener("online", function () {
          $rootScope.$$listeners.networkOnline = []; // not clearing watch --broken clear
        }, false)
      }
    };
  }]);

@@ -817,33 +817,32 @@
 on () %7B%0A        
-$
 document.addEven
@@ -868,32 +868,32 @@
 , function () %7B%0A
+
           var ne
@@ -1117,33 +1117,32 @@
 on () %7B%0A        
-$
 document.addEven
@@ -1421,33 +1421,32 @@
 on () %7B%0A        
-$
 document.removeE
@@ -1640,24 +1640,24 @@
 on () %7B%0A
+
         
 $documen
@@ -1648,17 +1648,16 @@
         
-$
 document

remove angluar $document