Он, некоторое время назад я опубликовал в блоге codigo200 пример Ionic3 + Leaflet, который решает вашу проблему, код в github, вы можете прочитать объяснение здесь .
// atributes
map: L.Map;
center: L.PointTuple;
tempIcon: any;
ionViewDidLoad() {
this.center = [23.03, -81.57]; //a place in Cuba
this.map = L.map('map', {
center: this.center,
zoom: 13
});
//Adicionamos la ruta de OSM.
L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: '© Código 200'
})
.addTo(this.map);
this.mensaje("Pulse sobre un punto en el mapa para añadir un nuevo lugar");
this.tempIcon = L.icon({
iconUrl: 'assets/imgs/marker.png',
shadowUrl: '',
iconSize: [32, 32], // size of the icon
shadowSize: [0, 0], // size of the shadow
iconAnchor: [32, 32], // point of the icon which will correspond to markers location
shadowAnchor: [0, 0], // the same for the shadow
popupAnchor: [32, 20] // point from which the popup should open relative to the iconAnchor
});
this.map.on('click', (e) => { this.onMapClick(e) });
}
onMapClick(e) {
let tempMarker = L.marker(e.latlng, { icon: this.tempIcon })
.on('click', this.showMarkerMenu, this) // Al hacer click, ejecutamos this.showMarkerMenu y le pasamos el contexto (this)
.addTo(this.map);
this.mensaje("Coordinate: " + e.latlng);
}
Итак, я надеюсь, что это решит вашу проблему, помните, что вам нужна ссылка листовка в index.html.