编辑:
我找到了一种如何在拖放时获取标记位置的方法。您可以为标记设置回调函数:
<google-map center="center" zoom="zoom" control="googleMap">
<marker coords="coords" options="options" events="events">
</google-map>
然后在控制器中定义回调:
$scope.events: {
dragend: function (marker) {
$rootScope.$apply(function () {
console.log(marker.position.lat());
console.log(marker.position.lng());
});
}
}
旧答案:
目前不可能:
https ://github.com/nlaplante/angular-google-maps/issues/277
但是,您可以获得原始的 google.maps.Map 对象:
指令调用:
<google-map center="center" zoom="zoom" control="googleMap"></google-map>
角度控制器:
...
$scope.center = = {
latitude: 48.13171,
longitude: 11.549554
};
$scope.zoom = 8;
$scope.googleMap = {}; // this is filled when google map is initiated
function getMapObject() {
$scope.googleMap.control.getGMap();
}
...