Google maps 谷歌地图没有在Ionic2上显示

Google maps 谷歌地图没有在Ionic2上显示,google-maps,angular,ionic2,Google Maps,Angular,Ionic2,我已经成功地学习了下面的教程。但是,当我在多个页面中添加导航时,地图将停止加载。仅当我将其设置为根页面时,它才会加载 我尝试了以下形式的一些建议,但没有成功。它在浏览器中工作,但在android模拟器中启动时不工作 这是我的网页 import { Component, ViewChild, ElementRef } from '@angular/core'; import { NavController } from 'ionic-angular'; import { Geolocation

我已经成功地学习了下面的教程。但是,当我在多个页面中添加导航时,地图将停止加载。仅当我将其设置为根页面时,它才会加载

我尝试了以下形式的一些建议,但没有成功。它在浏览器中工作,但在android模拟器中启动时不工作

这是我的网页

import { Component, ViewChild, ElementRef } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Geolocation } from 'ionic-native';

declare var google;

@Component({
  selector: 'home-page',
  templateUrl: 'home.html'
})
export class HomePage {

  @ViewChild('map') mapElement: ElementRef;
  map: any;

  constructor(public navCtrl: NavController) {

  }

  ngOnInit(){
    this.loadMap();
  }

  loadMap(){

    Geolocation.getCurrentPosition().then((position) => {

      let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);

      let mapOptions = {
        center: latLng,
        zoom: 15,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }

      this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);

    }, (err) => {
      console.log(err);
    });

  }

}

您使用的是什么版本?能否在“new google.maps.Map”之前添加一些日志,以确保在该版本之前都能被调用?“ionViewLoaded”不再是有效的生命周期事件。但这不应该是你们的问题,因为你们说它在浏览器中工作。您必须使用较旧的版本2.0.0-rc.5Fixed。实际上是在使用ngOnInit。