cordova-plugin-googlemaps: HtmlInfoWindow error: marker.getId is not a function
I’m submitting a … (check one with “x”) [ ] question [x] any problem or bug report [ ] feature request
plugin version: (check one with “x”) [ ] 1.4.x [x] 2.0.0-beta2
cordova information: (run $> cordova plugin list)
com.googlemaps.ios 2.3.0 "Google Maps SDK for iOS"
cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-globalization 1.0.7 "Globalization"
cordova-plugin-googlemaps 2.0.0-beta2-20170731-1540 "cordova-plugin-googlemaps"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sms-plugin 0.1.11 "Cordova SMS Plugin"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
cordova.plugins.diagnostic 3.6.5 "Diagnostic"
ionic-plugin-keyboard 2.2.1 "Keyboard"
Current behavior: I add to the map many Marker. When I try to open the HtmlInfoWindow from a marker, I get this error : Unhandled Promise rejection: marker.getId is not a function ; Zone: <root> ; Task: null ; Value: TypeError: marker.getId is not a function
Related code, data or error log (please format your code or data):
loadMap() {
...
var htmlInfoWindow = new HtmlInfoWindow();
htmlInfoWindow.setContent(`
<div>test</div><br>
`)
this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
this.cameras.map(cam => {
let latLng: LatLng = new LatLng(cam.position_y, cam.position_x);
this.map.addMarker({
position: latLng
}).then((marker: Marker) => {
marker.on(plugin.google.maps.event.MARKER_CLICK).subscribe(() => {
htmlInfoWindow.open(marker);
});
})
})
});
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (11 by maintainers)
The bug was fixed in the @ionic-native/core and @ionic-native/google-maps ver4.2.0
Please reinstall these two packages.
https://www.npmjs.com/package/@ionic-native/core https://www.npmjs.com/package/@ionic-native/google-maps
How did you write your code? And you should not ask another question on this thread. The original questioner asked about HtmlInfoWindow, not mapToolbar. You should create another issue.
https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/Map/setOptions/README.md#mapsetoptions
@ ionic-native/google-maps plugin has been not updated yet.
Yes, the current ionic wrapper plugin has bug. We are fixing bugs. Until the time, you can not use HtmlInfoWindow through the ionic wrapper plugin.