我已经在我的Angular 6应用程序中实现了@asymmetrik/ngx-leaflet,除了弹出窗口之外,一切都正常。在我展示地图上的一些标记后,它显示的像图片中的那样:marker popup
我想在用户点击按钮时更改路由,但是使用Angular的(click)事件不会触发单击事件,我已经在onClick中实现了内联函数JavaScript,它在我单击弹出窗口之前调用了很多次,这样就无法正常工作。代码如下:
感谢您的请求。
this.listOfStations.map(station => {
if(Object.keys(station.location).length > 0){
this.markers.push(marker([station.location.coordinates[0],station.location.coordinates[1]],{
icon: icon({
iconSize: [ 25, 41 ],
iconAnchor: [ 13, 41 ],
iconUrl: 'assets/marker-icon.png',
shadowUrl: 'assets/marker-shadow.png'
})
})
.bindPopup(`
<div align='center'>
<p style='font-size:18px;font-weight:bold'>Station: ${station.stationCode}</p>
<p style='font-size:14px;font-weight:italic'>${station.description}</p>
<a class='btn btn-xs btn-primary button-me' (click)="${this.consoleThis()}">View</a>
</div>
`)
// .on('click', (e) => {
// this.zone.run(() => {
// this.router.navigate(['/dashboard/station/' + station.stationCode]);
// })
// })
)};
});
感谢您的请求。