【问题标题】:Get all Cluster Objects from Google Maps in Angular从 Angular 中的谷歌地图获取所有集群对象
【发布时间】:2014-07-24 23:17:35
【问题描述】:

我在这里使用 Google Maps Angular 库:https://github.com/nlaplante/angular-google-maps

尝试使用我现有的集群代码创建“切换集群”功能:

<google-map 
center="map.center" 
zoom="map.zoom"
draggable="true"
events="mapEventObject"
control="googleMap">

<markers 
    models="markers" coords="'coord'" 
    doCluster="map.cluster"
    clusterEvents="map.clusterEvents"
    events="markerEventObject">
</markers>

$scope.markers = [{
   coord: {
       latitude: -38,
       longitude: 50
   }
}]

问题在于 $scope.markers 是一个数组,而不是实际的 MarkerClusterer 对象。因此,我无法在没有对象的情况下调用 .removeMarkers() 方法以获得“切换”效果。

使用 Angular,我如何在地图上获取 MarkerClusterer 对象?我找不到 .getAllClusters() 方法或类似的方法!

【问题讨论】:

    标签: javascript angularjs google-maps google-maps-api-3


    【解决方案1】:

    遇到同样问题的朋友,问题在这里:https://github.com/nlaplante/angular-google-maps/issues/561 并没有被推送到最新的 master 分支。要修复,请使用当前的“开发”分支(截至 2014 年 7 月)。

    【讨论】:

      猜你喜欢
      • 2017-06-13
      • 1970-01-01
      • 2017-02-15
      • 2021-11-10
      • 2019-01-20
      • 2013-03-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多