How to get ng-map marker position after dragend?

2.5k Views Asked by At

I'm using ng-map for Angularjs, I'm using the following code to get marker position after drag event

<div class="mapWrap"   data-tap-disabled="true">

        <map center="43.07493,-89.381388" zoom="4"> 

          <marker draggable=true position="{{pos.lat}},{{pos.lng}}" 
          on-dragend="getCurrentLocation()"></marker>    
        </map>

$scope.getCurrentLocation = function(){

     $scope.pos = this.getPosition();
     concole.log($scope.pos.lat() +' '+ $scope.pos.lng());
}

But its not working. Any suggestions?

1

There are 1 best solutions below

2
dekztah On BEST ANSWER

Just get it from the event of on-dragend:

$scope.getCurrentlocation = function(e) {
    $scope.address.lat = e.latLng.lat();
    $scope.address.lng = e.latLng.lng();
};

At least this works for me.