Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229111

How to Check Network Connection on Every Page

$
0
0

use the below method in your app.components.ts

 if (this.network.type == "none") {
        this.checkNetwork("offline");
      }

      Observable.merge(this.network.onConnect(), this.network.onDisconnect())
        .subscribe(e => this.checkNetwork(e.type), err => console.error(err));


  checkNetwork(e) {
    if (e == "online") {
      
      this.loadingPopup.dismiss();
      this.createLoading();
      this.isOnline = true;
    } else {
   
      this.loadingPopup.present();


   
      this.isOnline = false;
    }
  }

Viewing all articles
Browse latest Browse all 229111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>