Reputation: 115
I tried to apply what is in the docs gor the google maps in ionic 2 as it is in the official site: Ionic Docs Google Maps
I got this error:
Type 'Promise<void>' is not assignable to type 'Marker'. Property '_objectInstance' is missing in type 'Promise<void>'. Ionic 2
as it is figured in the screenshot below:
Upvotes: 5
Views: 2660
Reputation: 63
try this:
map.addMarker(markerOptions)
.then((marker: Marker) => {
marker.showInfoWindow();
});
instead of
const marker: Marker = map.addMarker(markerOptions)
.then((marker: Marker) => {
marker.showInfoWindow();
});
Upvotes: 1
Reputation: 181
I had this error too, and the solution i've found is to not use marker variable, but only write
map.addMarker(markerOptions).then(...)
And it works, my marker was displayed.
Upvotes: 3