stefanocudini / leaflet-search

Search stuff in a Leaflet map
https://opengeo.tech/maps/leaflet-search/
MIT License
772 stars 334 forks source link

Does not work with marker cluster #296

Closed Kumail09 closed 2 years ago

Kumail09 commented 2 years ago
map.addControl( new L.Control.Search(
    {layer: markerCluster._featureGroup,
         propertyName: 'name', 
         initial: false,
         buildTip: function(text, val) {
            console.log("DSAdASD");
            console.log(val);
            var type = val.layer.feature.properties.amenity;
            return '<a href="#" class="'+type+'">'+text+'<b>'+type+'</b></a>';
        }

    }) );

Gives Error: Uncaught TypeError: Cannot read properties of undefined (reading 'properties')