Abdulaziz Busbate Abdulaziz Busbate - 7 months ago 38
AngularJS Question

How do I access the current location (lat, lng) of a map marker using ngMap in Angularjs?

I have an Angularjs website that requests geolocation from users using ngMap. Take a look at this plunker.

<map center="current-location" zoom="16">
<marker visible="true" centered="true" position="current-location" title="You are Here" draggable="true"></marker>

It works fine but how can I access (save or print) the current location or the marker's location after it's been dragged to a different place?


Here is a way to access a marker's location (lat, lng).

$scope.$on('mapInitialized', function(evt, evtMap) {
    $scope.map = evtMap;
  $scope.showMarkerLatlng = function(){