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

testing - Detect whether test has failed within fixture -

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

android - Create single AAR file from multiple modules using Gradle -