Angular 弹出元件的角度8传单弹出触发功能

Angular 弹出元件的角度8传单弹出触发功能,angular,leaflet,popup,Angular,Leaflet,Popup,我知道这个话题已经在一堆问题中反复讨论过了, 请原谅我的无知,因为从我的技能水平来看,它太复杂了 我的目标是:点击传单弹出窗口中的链接或按钮来触发一个功能(我的目标是从该按钮打开一个对话框) 我很少看到使用typescript的示例,并且不能适应大多数javascript 这是我最后一次尝试: this.map.on('contextmenu', (e) => { const content = L.DomUtil.create('div', 'content'); L.DomEvent.

我知道这个话题已经在一堆问题中反复讨论过了, 请原谅我的无知,因为从我的技能水平来看,它太复杂了

我的目标是:点击传单弹出窗口中的链接或按钮来触发一个功能(我的目标是从该按钮打开一个对话框)

我很少看到使用typescript的示例,并且不能适应大多数javascript

这是我最后一次尝试:

this.map.on('contextmenu', (e) => {
const content = L.DomUtil.create('div', 'content');
L.DomEvent.on(content, 'click', (event) => {
  console.log('test');
});
const popup = L.popup().setContent(content).setLatLng(e.latlng);
this.map.openPopup(popup);
});
}

关于如何在Typescript中设置弹出窗口的内容以调用函数的任何建议都是非常受欢迎的

最后,我找到了解决方法。 对于像我这样一直受此问题困扰的人,您可以尝试以下方法:

const popup = L.popup().setContent('<button id="button-submit" type="button">Add Marker</button>').setLatLng(e.latlng);
this.map.openPopup(popup);
const buttonSubmit = L.DomUtil.get('button-submit');
L.DomEvent.addListener(buttonSubmit, 'click', (ee) => {
this.logTest();
});
const popup=L.popup().setContent('Add Marker').setLatLng(e.latlng);
this.map.openPopup(弹出窗口);
const buttonSubmit=L.DomUtil.get('button-submit');
L.DomEvent.addListener(按钮提交,'click',(ee)=>{
这是logTest();
});