In this code, I was using data[key].category to indicate related Icon as the marker. but I want to replace it with font-awesome icons to make it light-weight on runtime in some places may load over tens of icons as the markers
var Cofee= Leaflet.icon({
iconUrl: '/img/Coffee.png',
shadowUrl: '/img/pale-shadow.png',
iconSize: [34, 49],
shadowSize: [49, 49],
iconAnchor: [5, 62],
shadowAnchor: [4, 62],
popupAnchor: [12, -30]
});
var Store= Leaflet.icon({
iconUrl: '/img/Store.png',
shadowUrl: '/img/pale-shadow.png',
iconSize: [34, 49],
shadowSize: [49, 49],
iconAnchor: [5, 62],
shadowAnchor: [4, 62],
popupAnchor: [12, -30]
});
..
..
..
this.Getlatlng(currentlatlng, 9000).then(data => {
for (var key in data) {
Leaflet.marker(data[key].location, { icon: data[key].category })
.addTo(this.map).bindPopup('<h4>'+data[key].caption+'</h4>');
markers.push([data[key].location.lat,data[key].location.lng]);
}