我在我的项目中使用 https://github.com/allenhwkim/angularjs-google-maps指令
以下是在地图上绘制标记的代码示例
<map id="map" style="height:450px" zoom="4" zoom-to-include- markers='auto' center="{[{center.lat}]},{[{center.long}]}" on-center-changed="centerChanged()">
<marker id={[{$index}]} animation="DROP" ng-repeat="location in locations" position="{[{location.latitude}]},{[{location.longitude}]}" on-click="click()" title="Click to zoom"></marker>
</map>
我现在必须从 javascript 函数中选择这些标记。通过 id 选择标记将标记作为 dom 元素,如下所示
<marker id="1" animation="DROP" ng-repeat="location in locations" position="10.0050407,76.3459498" on-click="click()" title="Click to zoom" class="ng-scope"></marker>
而不是谷歌地图标记对象
有没有办法我可以选择通过ng-repeat初始化的标记作为来自javascript的谷歌地图标记对象?