В моем приложении с помощью Google Place Map предопределенное местоположение, но мне нужно, чтобы имя местоположения lat и lng динамически отображалось на карте Google, когда маркер перемещается на Google
.
Я использую AngularJs 1,5
мой код такой
$scope.Markers =
{
"lat": '12.976154',
"lng": '77.445760',
}
//Setting the Map options.
$scope.MapOptions = {
center: new google.maps.LatLng($scope.Markers.lat, $scope.Markers.lng),
zoom: 7,
rotation: 45,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
//Initializing the InfoWindow, Map and LatLngBounds objects.
$scope.InfoWindow = new google.maps.InfoWindow();
$scope.Latlngbounds = new google.maps.LatLngBounds();
$scope.Map = new google.maps.Map(document.getElementById("dvMap"), $scope.MapOptions);
//Looping through the Array and adding Markers.
// for (var i = 0; i < $scope.Markers.length; i++) {
// var data = $scope.Markers[i];
var myLatlng = new google.maps.LatLng($scope.Markers.lat, $scope.Markers.lng);
//Initializing the Marker object.
var marker = new google.maps.Marker({
position: myLatlng,
map: $scope.Map,
title: $scope.Markers.title
});
//Adding InfoWindow to the Marker.
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
// $scope.InfoWindow.setContent("<div style = 'width:100px;min-height:40px'>" + data.description + "</div>");
// $scope.InfoWindow.open($scope.Map, marker);
});
})(marker, $scope.Markers);
//Plotting the Marker on the Map.
$scope.Latlngbounds.extend(marker.position);
// }
//Adjusting the Map for best display.
$scope.Map.setCenter($scope.Latlngbounds.getCenter());
$scope.Map.fitBounds ($scope.Latlngbounds);
Пожалуйста, помогите мне