angular-leaflet-directive
angular-leaflet-directive copied to clipboard
Cannot click on a marker.
After I have created a marker, I cant click on a marker instead new marker is getting created. Event "leafletDirectiveMarker.click" is not getting triggered.
Steps to reproduce it,
- create a marker and the marker should not have any popup message
- now click on the same marker
Event "leafletDirectiveMarker.click" triggering is expected.
What happens is, new marker will be created.
Same problem.
encountered the same
try leafletDirectiveMarker.[yourMapInstanceName].click event for eg.: leafletDirectiveMarker.map.click
since v0.9.0
Hello guys,
I had the same problem few weeks ago. You have to define event on newly created layers separately! Do this after you draw them.
Use this as an example:
// Defining behaviour of newly created layers!
leafletData.getMap('mapId').then(function(map) {
map.on('draw:created', function(e) {
var layer = e.layer;
layer.on('click', function(args) {
console.log('Clicked!');
});
});
});