How can I show popup and the details of the marker in mapboxgl cluster?

Viewed 600

I tried the following link example

I want to add the popup on the cluster and show all the clustered data as HTML on that. I can see the popup but getting undefined on the popup content.

map.on('click', 'cluster', function (e) {
    let description = "";

    for(let i = 0; i < e.features.length; i++) {
      description = description + e.features[i].properties.description;
      if(i != e.features.length - 1) {
          description = description + "</br>";
      }
    }

    new mapboxgl.Popup()
      .setLngLat(e.features[0].geometry.coordinates)
      .setHTML(description )
      .addTo(map);

  });
1 Answers

Solution found here: https://stackoverflow.com/a/47715517

var my_marker = L.marker([my_lat, my_lng], {icon: my_icon})
              .addTo(map)
              .bindPopup('My Popup HTML', {closeOnClick: false, autoClose: false})**
Related