Network.onConnect(...) doesn't trigger view update


I’m trying to make an “upload” button in my app hide or show based on the device’s network connectivity. I have the following code:

let deviceConnectedToInternet = => {
    this.deviceConnected = true;
let devicedisconnectedFromInternet = => {
    this.deviceConnected = false;

If I put a console.log in the arrow function, I can see that the observable is correctly triggering when the network connects or disconnects, and my boolean value is changing. But the view isn’t updating to reflect that change.

Any help is appreciated.


Try to use zone

constructor(private zone: NgZone) {

yourMethod() {
    let deviceConnectedToInternet = => { => {
         this.deviceConnected = true;


I did read about that a few different places, but all of the examples were a bit too complex to understand. Yours is perfectly simple, thank you!


No worries, let me know if it solves the problem :crossed_fingers:


That did the trick. Thank you so much!


Coolio thx for the feedback