【问题标题】:Angular-leaflet-directive: Open popup on dropAngular-leaflet-directive:在放置时打开弹出窗口
【发布时间】:2016-05-29 10:01:19
【问题描述】:

我正在尝试在放置时打开弹出窗口,但它不起作用,我已经尝试过

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

但是直到我第二次拖放标记后弹出窗口才会打开。

这不是它应该的工作方式,我该如何实现?

【问题讨论】:

    标签: angularjs leaflet angular-leaflet-directive


    【解决方案1】:

    使用L.MarkeropenPopup方法:

    打开先前由 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();
    });
    

    【讨论】:

      猜你喜欢
      • 2015-07-15
      • 1970-01-01
      • 2022-12-01
      • 1970-01-01
      • 2014-10-07
      • 2021-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多