I'm using Leaflet, I have bound popups to layers, and created a popupopen event listener on the map as follow:

map.on('popupopen', this._managePopUp.bind(this));

_managePopUp(layer) {
        console.log('popup listened !');
        this.elRef.nativeElement.querySelector('#Layer-delete').addEventListener('click', e => {
        this.elRef.nativeElement.querySelector('#Layer-edit').addEventListener('click', e => {

The problem is that when the #Layer-delete and #Layer-edit click event listeners are not executed when a popup is called, so I need to re-click on the map then on the layer, then on the delete or edit button, so that it works.

I think the problem is that the this.elRef reference is not updated while clicking directly on layers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.