Answer the question
In order to leave comments, you need to log in
How to update map coordinates when dragging google map marker?
There is such a code
<ng-map zoom="12" center="{{map.address}}" default-style="true">
<marker ng-repeat="marker in myMarkers" id="{{marker.id}}" position="{{marker.position}}" on-click="showDetail(event, marker)" icon="https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png" animation="DROP" draggable="true"></marker>
<info-window id="bar" max-width="200">
<div >
Position: {{anchor.getPosition()}}<br/>
<a href="#" ng-click="closeInfo()">Click Here</a>
</div>
</info-window>
</ng-map>
$scope.placeChanged = function() {
vm.place = this.getPlace();
vm.map.setCenter(vm.place.geometry.location);
$scope.myMarkers = [];
$scope.myMarkers.push({
id: 'generalMarker',
position: [vm.place.geometry.location.lat(),vm.place.geometry.location.lng()],
name: 'marker'
})
};
$scope.showDetail = function(e, marker) {
vm.map.showInfoWindow('bar', marker.id);
};
$scope.closeInfo = function(e) {
vm.map.hideInfoWindow('bar');
};
Answer the question
In order to leave comments, you need to log in
In native js:
google.maps.event.addListener(marker, 'dragend', function(evt){
// do code here
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question