2

I'm trying to open popup on drop, but it does not work, I've tried with

$scope.$on('leafletDirectiveMarker.dragend', function(event,args){
   args.model.focus = true;
});

and

$scope.$on('leafletDirectiveMarker.dragend', function(event,args){
    $scope.markers.forEach(function(marker){
        marker.focus = false;
    });
    args.model.focus = true;
});

But popup does not open until I drag and drop the marker for second time. Here how this should work

That's not how it should work, how can I achieve this?

Felix
  • 579
  • 1
  • 8
  • 23

1 Answers1

3

Use L.Marker's openPopup method:

Opens the popup previously bound by the bindPopup method.

http://leafletjs.com/reference.html#marker-openpopup

$scope.$on('leafletDirectiveMarker.dragend', function(event,args){
    // Marker which fires the event is stored in args.leafletObject
    args.leafletObject.openPopup();
});
iH8
  • 27,722
  • 4
  • 67
  • 76