I have a slight problem. Google maps is not showing in ionic 2 segments but showing outside of segments. I am using the following code,
<div [ngSwitch]="report_details">
<div *ngSwitchCase="'details'">
<div #map id="map"></div>
</div>
</div>
I have tried the following solutions but did not work:
- use height and width of 100% on outer div.
- use timeout on map load function.
You could try and break the map out into its own page and use the selector to load it in via the ngSwitch directive. That way you could work with the ionic hooks like ionViewDidEnter() and ionViewWillEnter();
in the console.
then in your HTML try using something like this.
map.ts
then you can do whatever you want in the map.ts/map.html and it will hook onto its own navCtrl in order to have much more flexibility.
I had the same problem as you point out, Google Maps is showing perfectly outside segments. So following the approach suggested by biranchi125 in Ionic forum you can place the map outside the segments and handle when to show it whith the selection variable, like this:
and it works : )