android - display connection error messages in ionic framework -


i developing ionic mobile app getting difficulty display connection error message. when device not connected internet or when there connection timeout or want show popup display error message. first time encountering this.

--first add plugin project in app.js include below code

js

document.addeventlistener("offline", onoffline, false);          $rootscope.online = true;         function onoffline() {             // handle offline event             $rootscope.$apply(function() {                 $rootscope.online = false;                alert("there no active internet connection app. please check connectivity.");                //implement method off error when connection terminates              });          }          document.addeventlistener("online", function() {             $rootscope.$apply(function() { alert("connected");                 $rootscope.online = true;                 $rootscope.closetoast();             });         }, false); 

here offile handle connection termination , online handle reconnection , check alerts or consoles


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -