I m new to @asymmetrik/ngx-pagelet and Angular in general, so this is maybe only a newbie-issue.
I have an Angular.io (v5) project using the @asymmetrik/ngx-leaflet-tutorial-ngcli
现在,我想得到我点击的坐标。 http://github.com/Asymmetrik/ngx-pagelet/issues/51”rel=“noreferer” 第51期在点击时获得坐标?。 我补充说:
map.on( click , () => { console.log(e.latlng); });
:
onMapReady(map: Map) {
map.fitBounds(this.route.getBounds(), {
padding: point(24, 24),
maxZoom: 12,
animate: true
});
map.on( click , () => { console.log(e.latlng); });
}
that gives me a runtime error:
Cannot find name e .
Which kind of makes sense to me. So, I changed the code :
map.on(点击,(e) =>{ console.log(e.latlng);};
但这也给我留下了一个错误:Property latlng在LafletEvent
上不存在。
When I just put e to the console console.log(e)
I can see the latlng-Property exists...
Why can t I access the coordinates with e.latlng
?
我的项目正在使用:
"@angular/cli": "1.4.7",
"@asymmetrik/ngx-leaflet": "^2.5.1",
"@types/leaflet": "^1.2.0",
"leaflet": "^1.2.0",