Google maps setMyLocationEnabled在离子2中不工作
在这段代码中,我试图找到一种方法来显示Google maps setMyLocationEnabled在离子2中不工作,google-maps,google-maps-api-3,ionic-framework,Google Maps,Google Maps Api 3,Ionic Framework,在这段代码中,我试图找到一种方法来显示我的位置按钮,但结果仍然相同 loadMap() { this.Geolocation.getCurrentPosition().then((position) => { let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); let mapOptions = { center: l
我的位置按钮
,但结果仍然相同
loadMap() {
this.Geolocation.getCurrentPosition().then((position) => {
let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
let mapOptions = {
center: latLng,
zoom: 15,
MyLocationEnabled: true,
setMyLocationButtonEnabled: true,
zoomControl: false,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP,
}
this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
this.addMarker();
}, (err) => {
console.log(err);
});
}
如下所示: