I have a map with external GeoJSON and a search box feature. I am having a problem with getting the popups to display. The markers display and the filter works fine currently. I looked at several suggestions here and here. It appears to be an easy fix but I have not been able to get any of the suggested solutions to work. I'm thinking I am missing some small detail. Any help is greatly appreciated.
Here is my GeoJSON variable and the popup I have been trying.
var locations = L.mapbox.featureLayer()
.setGeoJSON(geojson)
.addTo(map)
.on('ready', function(){
locations.eachlayer(function(layer){
var prop = layer.feature.properties;
var popup = '<b>' + prop.state + '</b>';
locations.bindPopup(popup);
})
})
.addTo(map);
You can remove the 'ready' callback, and just do