tombatossals / angular-leaflet-directive

AngularJS directive to embed an interact with maps managed by Leaflet library
http://tombatossals.github.io/angular-leaflet-directive
MIT License
1.5k stars 635 forks source link

Cant get update marker.lat marker.lng #1040

Open rosscdh opened 8 years ago

rosscdh commented 8 years ago

Hey there, trying to update a field value based on lat,lng but the event does not pass the current value for the dragged marker.

    $scope.$on('leafletDirectiveMarker.dragend', function(event){
        var marker = event.targetScope.markers.m1;

        vm.object.latitude = marker.lat;
        vm.object.longitude = marker.lng;

        console.log(event)
    });

Shows the old marker.lat and marker.lng

Any thoughts would be appreciated

lavahot commented 8 years ago

I get the latlng data from args.leafletEvent.target._latlng.lng;. It works, but I have no idea if it's "correct" or not.