Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about 2-way binding on marker lat/lng? #1069

Closed
gizm0bill opened this issue Jul 7, 2017 · 4 comments
Closed

How about 2-way binding on marker lat/lng? #1069

gizm0bill opened this issue Jul 7, 2017 · 4 comments
Labels

Comments

@gizm0bill
Copy link

gizm0bill commented Jul 7, 2017

(read title)
P.S. exportAs: 'agmMarker'

@matt-lethargic
Copy link

I'm new to Angular2 and AGM, but I would love this, really thought it would have been in already.
Does anyone know how to get the lat/lng from a dragged marker??

@danymill
Copy link

@matt-lethargic Smth like this:
<agm-marker [markerDraggable]="true" (dragEnd)="markerMoved($event)" [latitude]="latitude || 39.8282" [longitude]="longitude || -98.5795"></agm-marker>

markerMoved(e) { const geocoder = new google.maps.Geocoder(); geocoder.geocode({'location': e.coords}, (res, status) => { if (status === google.maps.GeocoderStatus.OK && res.length) { this.ngZone.run(() => this.setLocation(res[0])); } }) }

setLocation(place) { this.latitude = place.geometry.location.lat(); this.longitude = place.geometry.location.lng(); }

@rojasjandro89
Copy link

<agm-marker (dragEnd)="draggEnded($event)" [markerDraggable]="true" [latitude]="tripMirror.departure?.latitude" [longitude]="tripMirror.departure?.longitude" iconUrl="assets/icons/icon_marker_red.png"></agm-marker>

For some reason when I try to drag it I only move the entire map, I'm not able to move the marker...any help on this?

@stale
Copy link

stale bot commented Nov 13, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 13, 2018
@stale stale bot closed this as completed Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants