angular-leaflet-directive icon indicating copy to clipboard operation
angular-leaflet-directive copied to clipboard

Cannot click on a marker.

Open k-maheshkumar opened this issue 9 years ago • 4 comments

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,

  1. create a marker and the marker should not have any popup message
  2. now click on the same marker

Event "leafletDirectiveMarker.click" triggering is expected.

What happens is, new marker will be created.

k-maheshkumar avatar Dec 14 '15 13:12 k-maheshkumar

Same problem.

BakhtiyorRuziev avatar Jan 16 '16 01:01 BakhtiyorRuziev

encountered the same

vvavepacket avatar Jan 19 '16 12:01 vvavepacket

try leafletDirectiveMarker.[yourMapInstanceName].click event for eg.: leafletDirectiveMarker.map.click

since v0.9.0

Wilzi avatar Jan 27 '16 11:01 Wilzi

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!');
                });
            });
        });

imilicevic7 avatar Mar 15 '17 13:03 imilicevic7