I'm dealing with a problem I've been stuck on for a few days. I'm currently wanting my markers to navigate to another page when clicked on the Leaflet Map. So my understanding (correct me if I'm wrong) of the marker.on('click', someFunction)
leaflet method is that it is performed within the class of the marker even if the function is present in a page.ts file.
I would like some help on calling my router in my page.ts file to navigateByURL to another page when the marker is clicked.
The error I currently get is router Undefined and sometimes navigateByURL undefined.
What I currently have is...
displayMarkerLocations(){
this.places.forEach(place => {
var marker = L.marker([place.location.Y, place.location.X]);
marker.on('click', this.OnClick);
marker.bindPopup(place.address);
marker.noMoveStart = true;
marker.addTo(this.markerLayer);
});
}
onClick(e){
this.router.navigateByUrl('tabs/tab3');
}