call services of that page , if (mobile app) net online angularjs + cordova (android and IOS) -


if mobile data on, want reload current page, how know net on.

added below code deviceready event

document.addeventlistener("online", function togglecon(e, $route) {     if (e.type == "offline") {         navigator.notification.alert("sorry, offline.", function() {}, "offline!");     } else {         //  navigator.notification.alert("woot, online.", function () { }, "online!");         $route.reload();     } }, false); 

it's working once device ready, if connection lost in between.

i want reload current page services ,is there way identify that.

online event called every time app got online.

deviceready event fired when app loaded. online event registered after that.

if app lost connection after , came online event , callback called.


Comments