Cluster click event handling with Angular 11 and Google Maps API
P粉798343415
P粉798343415 2023-09-16 22:57:11
0
1
502

I am working on an angular 16 project.

this.markerCluster = new MarkerClusterer({map:this.map, markers: this.markers, renderer, onClusterClick:this.listCluster.bind(this), });
listCluster(cluster){ let markers = cluster.getMarkersList(); console.log(markers); }

I need to get the list of markers present in a specific cluster. I've tried getMarkers() and getMarkersList() but neither works.

P粉798343415
P粉798343415

reply all (1)
P粉464082061

You are trying to use a method to get markers in a cluster, but the method you need depends on the specific version of theMarkerClustererlibrary you are using.

In newer versions of the @google/markerclusterer library (since v3), you can use thegetMarkers()method to retrieve markers within a cluster:

listCluster(cluster){ let markers = cluster.getMarkers(); console.log(markers); }
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!