Created
November 3, 2017 15:09
-
-
Save calendee/5a3ef001f29174c12df48cd3cffc8b06 to your computer and use it in GitHub Desktop.
Forcing App to Change Network Status
This file contains hidden or 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 app = document.getElementsByTagName('body'); | |
var scope = angular.element(app[0]).scope(); | |
var rootScope = scope.$root | |
// Make app think you're offline | |
scope.$apply( function() { | |
rootScope.$broadcast('$cordovaNetwork:offline'); | |
}); | |
// Make app think you're online | |
scope.$apply( function() { | |
rootScope.$broadcast('$cordovaNetwork:online'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment