Ayyoub Ayyoub - 16 days ago 4x
AngularJS Question

Get Cordinates on mouse click on google map api v3 and angularJS

$scope.map = {
center: {
latitude: 36,
longitude: -80
zoom: 3,
showOverlay: true,
events: {
"click": function ()
{ console.log(" latitude: " + $scope.map.center.latitude + "longitude: " + $scope.map.center.longitude); }
options: {
streetViewControl: false,
panControl: false,
maxZoom: 20,
minZoom: 1,


So I have a problem to get the longitude and latitude of my mouse click event using angularJS and the google map api v3. Here is an example of my controller. I've added an event to the map so to get the cordinates, but now what i'm getting is just the cordinates of the center. I don't have any idea how to get the exact cordinates of my mouse click event. Thanks for your help.


You must implement a listener that catches the click and gets location:

google.maps.event.addListener(map, 'click', function(event) {
    alert(event.latLng);  // in event.latLng  you have the coordinates of click

Check this DEMO FIDDLE