我尝试在官方网站中应用离子2中的google地图文档中的内容:Ionic Docs Google Maps
我收到了这个错误:
Type 'Promise<void>' is not assignable to type 'Marker'. Property '_objectInstance' is missing in type 'Promise<void>'. Ionic 2
答案 0 :(得分:3)
我也有这个错误,我发现的解决方案是不使用标记变量,但只写
map.addMarker(markerOptions).then(...)
它有效,我的标记显示出来。
答案 1 :(得分:1)
试试这个:
map.addMarker(markerOptions)
.then((marker: Marker) => {
marker.showInfoWindow();
});
而不是
const marker: Marker = map.addMarker(markerOptions)
.then((marker: Marker) => {
marker.showInfoWindow();
});