You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior
Giving this error
MapComponent.html:49 ERROR TypeError: marker.getPosition is not a function
at MapComponent.Array.concat.MapComponent.showInfo (map.ts:44)
at Object.eval [as handleEvent] (MapComponent.html:49)
at handleEvent (core.js:13589)
at callWithDebugContext (core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at core.js:10629
at HTMLElement. (platform-browser.js:2628)
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)
Expected/desired behavior
Should show info window on click of custom-marker
The text was updated successfully, but these errors were encountered:
You're passing an event to showInfo function, which holds the actual DOM element as target. This element does not have a getPosition method, nor has a nguiMapComponent property.
Use the initialized$ event of the custom marker to create an array of markers, and then pass the corresponding custom marker to the openInfoWindow function. E.g.
HTML: <custom-marker *ngFor="let pos of positions; let i = index" [position]="pos]" (initialized$)="onMarkersInit($event)" > <div (click)="showInfo(i)"></div> </custom-marker>
IMPORTANT
Please be specific with an example. An issue with no example or unclear requirements may be closed.
Steps to reproduce and a minimal demo
-html
<custom-marker *ngFor="let pos of positions" [position]="pos" (click)="showInfo($event)">
-ts
showInfo({target: marker}) {
this.marker.lat = marker.getPosition().lat();
this.marker.lng = marker.getPosition().lng();
marker.nguiMapComponent.openInfoWindow('iw', marker);
}
Current behavior
Giving this error
MapComponent.html:49 ERROR TypeError: marker.getPosition is not a function
at MapComponent.Array.concat.MapComponent.showInfo (map.ts:44)
at Object.eval [as handleEvent] (MapComponent.html:49)
at handleEvent (core.js:13589)
at callWithDebugContext (core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at core.js:10629
at HTMLElement. (platform-browser.js:2628)
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)
Expected/desired behavior
Should show info window on click of custom-marker
The text was updated successfully, but these errors were encountered: