I'm trying to implement search capability on my leaflet map using leaflet-fusesearch
I manage to get the search control added to the map but the search function itself is not working.
Here's how I'm trying to add geojson to the search - any help very much appreciated.
$.ajax({
beforeSend: function(request) {
//request.setRequestHeader("X-Mashape-Key", 'key_here');
},
dataType: "json",
success: function(response) {
geojsonLayer = L.geoJson(response, {
onEachFeature: function (feature, layer) {
layer.setIcon(incidentIcon);
layer.bindPopup ("Incident<p>Road: "+feature.properties.location.road+"<p>Direction: "+feature.properties.location.direction);
}
}).addTo(map);
var props = ['road'];
fuseSearchCtrl.indexFeatures(geojsonLayer.features, props);
}
});