Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49230

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

$
0
0

@mlynch wrote:

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.network.onConnect().subscribe(ret => {
    this.deviceConnected = true;
});
let devicedisconnectedFromInternet = this.network.onDisconnect().subscribe(ret => {
    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.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49230

Trending Articles



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