M
M
Maxim2015-03-24 21:40:38
leaflet
Maxim, 2015-03-24 21:40:38

How to trigger a "click" event in Angular Leaflet if there is only a dom element?

There is an element found by id. This element is a marker element on the map. You need to trigger an event on this element in order to click on the marker on the map.
triggerHandler("click") has no effect.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
My joy, 2015-03-25
@t-alexashka

el = document.getElementById('map_element');
el.dispatchEvent('click');

Try like this

M
Maxim, 2015-04-04
@Masik

If I understand correctly, you want this:

$scope.$on('leafletDirectiveMarker.click', function(event, args) {
  console.log(event, args);
});

Those. will be triggered when the marker is clicked, the marker itself is in args .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question