0

I'm currently developing a Ionic App. On one Page i have a Google Map and want to show a Button when the Map is ready, so i introduced a variable, that is set to true when the Google Maps onReady is called. This works fine for Android, but on iOS it does not work (i think because the internal WebView is different). When i then interact with the Page, for example open the Side Menu, the whole View updates and the Button show up.

Thinks i already tried after i set the variable to true:

// Detect Changes
this.changeDetectionRef.detectChanges();

// Mark View as dirty
ɵmarkDirty(this);

// Try to set the Variable in NgZone:
this.zone.run(() => {
  variable = true;
});

Any Ideas why the View isn't updating?

EDIT: I just noticed it is only on App Startup (it's the main Page). When i go to another Page and the go back, it works

EinfachHans
  • 247
  • 3
  • 13
  • To me this sounds like a change detection issue, and it looks like you believe so too. One way to test if that is the case is to turn the variable you set to true into an object with a property. For instance `this.variable = { isReady: true }` then see if that changes things. In your html you need to update your variable to reflect that. By doing that you will get a new reference and hopefully the change detection will also notice that. Otherwise if that hasn't work, I've used BehaviorSubjects in the past. I am however not sure if this is the problem, hence just commenting. – Inge Olaisen Feb 26 '20 at 20:57
  • @IngeOlaisen thanks for your comment. I tried both, doesn't work :/ – EinfachHans Feb 27 '20 at 12:12

0 Answers0