从标记聚类器获取标记

时间:2019-04-13 22:33:42

标签: angular markerclusterer

我正在尝试console.log记录单击标记群集时遇到的事件,但是控制台中没有响应,也没有错误。

我正在使用getMarkers方法(可从MarkerCluster界面找到)。

cluster.model.ts

export interface MarkerClustererInstance {
  getMarkers(): Marker[];
}

html

<agm-marker-cluster #markerCluster (click)="findMarkers()" imagePath="https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m">

ts

import { MarkerClustererInstance } from '../../models/cluster.model';

  @ViewChild('markerCluster') public markerCluster: MarkerClustererInstance;

  findMarkers() {
    console.log(this.markerCluster.getMarkers());
  }

0 个答案:

没有答案
相关问题