【发布时间】:2015-10-05 14:47:01
【问题描述】:
我正在尝试将Leaflet Editable functionality 添加到我当前的地图中,该地图是由传单指令创建的。我正在获取 L.map 实例:
leafletData.getMap().then(function(map) {
// where map is the Leaflet map instance
}
但是,Leaflet 可编辑需要在创建地图时设置editable: true。
那么,有没有办法创建一个 L.map 实例
var map = L.map('map', {editable: true});
然后将其附加到 Leaflet 角度指令?
更新:
我试图给 Leaflet 添加一个钩子
L.Map.addInitHook(function () {
this.whenReady(function () {
this.editTools = new L.Editable(this, this.options.editOptions);
console.log('L.map', this);
});
}
它成功创建了editTools,但是
map.editTools.startPolyline();
还是不行
【问题讨论】:
标签: leaflet angular-leaflet-directive