angular - Angular2 and LeafletJS locate() -
i'm working on ionic 2 application learn how use maps etc , want locate user on map on button click event, showing marker well. in leafletjs docs mentions
function onlocationfound(e) { var radius = e.accuracy / 2; l.marker(e.latlng).addto(map) .bindpopup("you within " + radius + " meters point").openpopup(); l.circle(e.latlng, radius).addto(map); } map.on('locationfound', onlocationfound);
but i'm not sure how call map.on within ionic2 app.
i have method :
onlocateme() { this.map.locate({ setview: true, maxzoom: 16, enablehighaccuracy: true }); this.map.on('locationfound', this.onlocationfound); }
which thought work call onlocationfound method, does't work. how can use map.on call once map.locate() method called?
Comments
Post a Comment