angulartypescriptangular-maps

How to get Latitude and Longitude from google maps latLng Object


I integrated angular google maps with my application to get the latitude and longitude of a certain place by dragging a marker.I successfully returned an object which encapsulates the latitude and longitude fields but I am not knowing how to access them and assign them to local variables in my application.Any idea ? Here is a picture of my chrome console

enter image description here


Solution

  • Well, you have a . at the end of lat() instead of a ; which is messing up your code. Try this:

    this.latitude = $event.latLng.lat();
    this.longitude = $event.latLng.lng();