angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

Maps doesn't appear when I use lazy loading from Ionic 3

Open edisonmatoso opened this issue 8 years ago • 4 comments

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

edisonmatoso avatar Jan 24 '18 17:01 edisonmatoso

Did you set a default height in the CSS for the AGM element? Need a fixed height to start with to display it.

timcblank avatar Feb 08 '18 22:02 timcblank

Yes, @timcblank , I set it. It's works well without lazy loading, but if I implement this, stop working.

edisonmatoso avatar Feb 13 '18 11:02 edisonmatoso

I finally solved this. I imported in NgModule of app.module instead of the NgModule of the component.module

edisonmatoso avatar Feb 13 '18 12:02 edisonmatoso

Hi @edisonmatoso, I don't understand what you meant. I am having the same issue but with Android.

Uctech avatar Jun 21 '18 20:06 Uctech