Typescript leaflet marker popup with clickable button

write in map.ts

popupOptions = { className: "customPopup" };this.popupMessage='<button class="postGim">Mesaj Yolla</button> ';setMyCoords() {this.geolocation.getCurrentPosition().then((resp) => {this.myY_coord = resp.coords.latitudethis.myX_coord = resp.coords.longitude}).catch((error) => {console.log(this.en_error_getting_location, error);});
this.markerlat = this.myY_coord;this.markerlng = this.myX_coord;addmarker(){Leaflet.marker([this.markerlat, this.markerlng]).addTo(this.map).bindPopup(this.popupMessage, this.popupOptions).on("popupopen", (a) => {var popUp = a.target.getPopup()popUp.getElement().querySelector(".postGim").addEventListener("click", e => {this.buttonAction();});}).openPopup();}buttonAction() {console.log("buttonAction() cagrildi");}

We are writing the button as popup message but you know typescript cannot do anything in it.

Catch the class in javascript named postGIM here and return to typescript.:)