【发布时间】:2018-07-22 04:27:55
【问题描述】:
自从我将 Google 地图移到另一个页面后,我在使用 Ionic 应用程序时遇到了问题。它从未出现在根/主页上。在 iOS 上,地图显示得很好,但在 Android 上,从未触发 MAP_READY 事件,因此在下面的示例中,我没有看到“地图已准备好”。
ionViewDidLoad() {
this.platform.ready().then(() => {
console.log('Platform ready');
this.loadMap();
});
}
loadMap() {
let mapOptions: GoogleMapOptions = {
camera: {
target: {
lat: this.lat,
lng: this.lon
},
zoom: 5
},
controls: {
myLocationButton: true,
compass: true
}
};
this.map = GoogleMaps.create('map_canvas', mapOptions);
console.log('Map created');
this.map.one(GoogleMapsEvent.MAP_READY)
.then(() => {
console.log('Map is ready!');
}, (err) => {
console.log("Error is ",err);
}
);
)
【问题讨论】:
-
promise 捕获错误了吗?
-
我添加了 .catch 但也没有运行。
标签: google-maps ionic-framework