我在用户注册页面上使用angular-google-maps。我希望从我在地图上放置的地图标记中获取州,城市,地点,街道名称,邮政编码。怎么实现呢?
<ui-gmap-google-map ng-if="map.view" center="property.Location" zoom="map.zoom">
<ui-gmap-marker events="map.events" idkey="'1'" coords='property.Location' options="{draggable:true}" icon="'images/icon/ic_location_city_24px.svg'"></ui-gmap-marker>
控制器代码
$scope.map = {
zoom: 11,
markers: [],
events: {
dragend: function (mapModel, eventName, marker, orignalEventArgs) {
console.log(marker);
var e = originalEventArgs[0];
var lat = e.latLng.lat(),lon = e.latLng.lng();
var marker = {
id: Date.now(),
coords: {
latitude: lat,
longitude: lon
}
};
$scope.map.markers.push(marker);
console.log($scope.map.markers);
$scope.$apply();
}
},
view: true
};