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
Post a Comment