我已经在我的 angular 6 应用程序中实现了 @asymmetrik/ngx-leaflet,除了弹出窗口之外,一切正常。在我在地图中显示了一些标记后,它的显示就像图片中的一样:标记弹出窗口
我想在用户单击按钮时更改路线,但是从角度的(单击)事件不会在单击事件中触发,我已经在 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]);
// })
// })
)};
});
Run Code Online (Sandbox Code Playgroud)
谢谢。