I want to know about the marker information that are grouped under marker clustering in AGM google Maps.
<agm-map #agmMap [latitude]="latitude" [longitude]="longitude" [zoom]="zoomMap" [fitBounds]="true"
(boundsChange)="checkMarkersInBounds($event)" [scrollwheel]="null">
<agm-marker-cluster [maxZoom]="maxZoom" [gridSize]="50" [averageCenter]="true"
imagePath="https://raw.githubusercontent.com/googlearchive/js-marker-clusterer/gh-pages/images/m">
<agm-marker *ngFor="let data of mapArrayListAccordingParams;let i=index" [latitude]="data.latitude"
[longitude]="data.longitude" [agmFitBounds]="true" [gestureHandling]="cooperative"
(markerClick)="clickedMarker(infowindow,data);selectedEmp = data;newSelectedEmp.push(data)">
</agm-marker>
</agm-marker-cluster>
</agm-map>
This is the code i am using for clustering, i want to know the information about each marker which are clustered under one group.
Okay :) I have finally found a solution. So, here is the answer:
Create a directive, which you will use instead of
agm-marker-clusterMine is named
ct-marker-clusterAnd what we need - is to change clusterclick default behavior.
I have removed the default handler.
And added a new one:
Then, in your template pass an
$eventargument to theclusterClickevent:<ct-marker-cluster (clusterClick)="onClusterClick($event)">And finally:
Full source code of the directive can be found below: