Maps doesn't appear when I use lazy loading from Ionic 3
Issue description When I use lazy loading the map doesn't appear. The problem is similar when you do not set css property.
I don't need this in this moment, but someone else may need it. Please, correct me if I'm wrong.
Steps to reproduce and a minimal demo of the problem
Constructing the map
component.html
<ion-content>
<agm-map [latitude]="lat" [longitude]="lng" [zoom]="20" style="height: 100%">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
</ion-content>
component.ts
this.geolocation.getCurrentPosition()
.then(
(location) => {
this.lat = location.coords.latitude;
this.lng = location.coords.longitude;
}
)
.catch(
(error) => console.log(error)
);
Importing page
app.component.ts
this.pages = [
{ title: 'OtherPage', component: 'OtherPage', home: true, mobile: false },
{ title: 'OtherPage', component: 'OtherPage', home: false, mobile: false },
{ title: 'Mapa', component: 'MapaPage', home: false, mobile: false }
];
If I import normally (without lazy loading) everything happens fine.
Ionic Framework: 3.9.2 Ionic App Scripts: 3.1.6 Angular Core: 5.0.3 Angular Compiler CLI: 5.0.3 Node: 8.9.3 OS Platform: Windows 10
Did you set a default height in the CSS for the AGM element? Need a fixed height to start with to display it.
Yes, @timcblank , I set it. It's works well without lazy loading, but if I implement this, stop working.
I finally solved this. I imported in NgModule of app.module instead of the NgModule of the component.module
Hi @edisonmatoso, I don't understand what you meant. I am having the same issue but with Android.