Undefined LatLng google map in AngularJs Controller -


i want retrieve longitude , latitude position of click mouse event, can't, gives me undefined. 1 can me please ?
i'm using angularjs , found can

google.maps.event.addlistener(map, 'click', function(event) {     console.log(event.latlng); }); 

but can't in controller gives me error, or maybe don't know how use that!!

here code :

$scope.map = {         center: {             latitude: 36,             longitude: -80          },         events: {             "click": function (event) {                 console.log(event.latlng);               }          }      } 

and tried gives me (nan,nan)

  $scope.map = {             center: {                 latitude: 36,                 longitude: -80              },             events: {                 "click": function (event) {                     var pos = new google.maps.latlng(event.latlng, event.latlng);                     console.log("position: " + pos);                   }              }          } 

i solve that

  events: {         tilesloaded: function (map, eventname, originaleventargs) {             //map trueley ready callback hit         },         click: function (mapmodel, eventname, originaleventargs) {             var e = originaleventargs[0];             var lat = e.latlng.lat(),lon = e.latlng.lng();             console.log("lat long: "lat, lon);             $scope.$apply();         }     } 

Comments

Popular posts from this blog

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -

How to run C# code using mono without Xamarin in Android? -