在Android工作但在iOS设备中,没有任何反应。 我尝试将调用loadMap的块代码放在ionViewDidLoad,ngOnInit和ngAfterViewInit方法中,但是没有任何反应
import { GoogleMaps, GoogleMap, GoogleMapOptions } from '@ionic-native/google-maps';
import { Component } from "@angular/core";
import { Platform } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
map: GoogleMap;
mapElement: HTMLElement;
constructor ( platform: Platform, private googleMaps: GoogleMaps ) {
platform.ready().then(() => {
try {
this.loadMap();
} catch ( e ) {
console.error(e);
}
})
}
loadMap () {
this.mapElement = document.getElementById('map');
let mapOptions: GoogleMapOptions = {
camera: {
target: {
lat: 43.0741904,
lng: -89.3809802
},
zoom: 18,
tilt: 80
}
};
//this.map = new GoogleMap(this.mapElement, mapOptions);
this.map = this.googleMaps.create('map', mapOptions);
}
}