I am using Angular 5 and ngx leaflet including the marker cluster. Everything works fine but the click function always outputs the name of the last element of the list whereas the tooltip contains the correct name.
for (var i of this.list) {
var markerItem = L.marker([i.lat, i.lng], {icon})
.bindTooltip('<h5>'+i.name+'</h5>')
.on('click', () => {
console.log(i);
this.draw(i);
});
data.push(markerItem)
}
this.markerClusterData = data;