Created
December 10, 2015 15:25
-
-
Save pfallasro/51a839a0f2444a25fde9 to your computer and use it in GitHub Desktop.
Plugin Desconexion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var noInternetPopup = null; | |
$scope.showPopup = function() { | |
noInternetPopup = $ionicPopup.show({ | |
template: '<p>Por favor verifique que el servicio de red esté habilitado.</p>', | |
title: 'No hay conexión a internet', | |
scope: $scope | |
}); | |
}; | |
$scope.closePopup = function () { | |
noInternetPopup.close(); | |
}; | |
document.addEventListener("deviceready", function () { | |
// listen for Online event | |
$rootScope.$on('$cordovaNetwork:online', function(event, networkState){ | |
var onlineState = networkState; | |
$scope.closePopup(); | |
}); | |
// listen for Offline event | |
$rootScope.$on('$cordovaNetwork:offline', function(event, networkState){ | |
var offlineState = networkState; | |
//alert('Deconectado'); | |
$scope.showPopup(); | |
}) | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment