Skip to content

gmp-map click event #268

@datzgit

Description

@datzgit

Hello everyone!

I am building an Angular App and I was trying to integrate this extended-component-library to make use of gmp-map component. I couldn't find a way to listen for user clicks on the gmp-map so I can get the exact LatLng where the user clicked, so that I can update the position of the gmp-advanced-marker component.

My goal is to have something like this in the html:

<gmp-map [center]="center()" zoom="17" map-id="DEMO_MAP_ID" (click)="updateMarker($event)"> <gmp-advanced-marker [position]="latLng()"></gmp-advanced-marker> </gmp-map>

and in the component code:

latLng = model<google.maps.LatLngLiteral>({ lat: -33.86, lng: 151.22, });

updateMarker(event: google.maps.MapMouseEvent) { if (event.latLng) { this.latLng.set(event.latLng.toJSON()); } }

Can anyone provide me with some help in this direction?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage meI really want to be triaged.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions