Is there a function that I can call to close all open popups in the angular-leaflet directive? Working from the jQuery suggestion from here I have tried the following:
document.getElementsByClassName('.leaflet-popup-close-button').click();
but I get
TypeError: undefined is not a function
alternatively, I have tried:
document.getElementsByClassName('.leaflet-popup-close-button')[0].click();
but that does not work either:
TypeError: Cannot read property 'click' of undefined
Looking through the original Leaflet docs, the solution is to get the native Leaflet map object and call functions on that.