I have made a Google map that shows the current address on the map. I also have draggable marker which is fixed at the center of map. So the user can change the marker by moving map.
I am trying to fetch the formatted address of the marker when loaded & also want to display the formatted address after dragged. How can i achieve that?
I have tried a few methods from google documentation but couldn’t find the proper solution.
Below is my .ts file
this.geocoder = new google.maps.Geocoder();
this.geolocation.getCurrentPosition().then((position) => {
let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var mapOptions = {
center: latLng,
zoom: 17,
streetViewControl: false,
mapTypeControl: false,
fullscreenControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
this.map = new google.maps.Map(this.mapRef.nativeElement, mapOptions);
//Place a draggable marker on the map
var marker = new google.maps.Marker({
position: latLng,
map: map,
animation: google.maps.Animation.BOUNCE,
draggable: true,
title: "Drag me!"
});
}, (err) => {
console.log(err);
});
Please Help Stuck badly