Angular-leaflet-directive:在drop上打开弹出窗口

时间:2016-02-17 15:36:06

标签: angularjs leaflet angular-leaflet-directive

我正在尝试打开弹出窗口,但它不起作用,我尝试过

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

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

但是直到我第二次拖放标记时弹出才会打开。 Here how this should work

这不是它应该如何运作,我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:3)

使用L.Marker' openPopup方法:

  

打开以前由bindPopup方法绑定的弹出窗口。

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();
});