我使用以下方法在我的网络应用程序中嵌入了Google地图:
<div>
<map ng-transclude class="google-map" center="map.center" options="map.options">
<marker position="marker.position" decimals="marker.decimals" options="marker.options" on-click="updatelatlong()"></marker></map>
</div>
&#13;
和控制器:
$scope.map = {
center: [39, -121],
options: function() {
return {
streetViewControl: false,
scrollwheel: false
}
}
};
$scope.marker = {
position: [39, -121],
decimals: 4,
options: function() {
return { draggable: true };
},
events:{
drag:function(e, p, map, points) {
console.log("dragged.....");
}
}
};
&#13;
我正在尝试记录与新拖动标记相关联的纬度经度。但是,控件不会来到拖动事件侦听器。
答案 0 :(得分:0)
解决方法如下:
<map ng-transclude class="google-map" center="map.center" options="map.options">
<!--<marker position="marker.position" decimals="marker.decimals" options="marker.options"></marker>-->
<points coords="points.coords" options="points.options" events="points.events" decimals="points.decimals"></points></map>
</div>
&#13;
控制器:
$scope.map = {
center: [39, -121],
options: function() {
return {
streetViewControl: false,
scrollwheel: false
}
}
};
$scope.points = {
coords: [
[47,-122]
],
options: function(coords, properties, i, map) {
return {
draggable: true
}
},
events: {
drag: function(e, point, map, points) {
$scope.longitude=e.latLng.lng();
$scope.latitude=e.latLng.lat();
}
},
decimals: 3
};
&#13;