I am using ng-map to use google map in angularjs. I want to get address safter drag end of marker. I have tried to find in their documentation but did not found for that. Their documentation is good but did not found what i wanted. After trying i got the lat and log after drag end. But i need the address. So what i have to do is to get address from marker or i can convert lat & long to address. But i did not find any code for geocoder to convert lat long to address. Here is the code from where i can the lat & long :-
<ng-map>
<marker centered="true" position="current-location" draggable="true" on-dragend="getCurrentLocation()"></marker>
</ng-map>
here is the method :-
$scope.getCurrentLocation = function(){
$scope.pos = this.getPosition();
console.log($scope.pos.lat(),$scope.pos.lng());
}
Please help me to find the address after dragging the marker.
In the function $scope.getCurrentLocation(), it receives a parameter, you can use it to get the location (lat,lng) for the marker.
Your code would be:
$scope.getCurrentLocation = function(event){
console.log(event.latLng.lat());
console.log(event.latLng.lng());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With