Reputation: 827
I am using http://angular-ui.github.io/angular-google-maps and I am not able to catch the event of simple click on the map.
I tried it like this:
_scope.map = {
center: { latitude: position.coords.latitude, longitude: position.coords.longitude },
zoom: 16,
events: {
click: function(mapModel, eventName, originalEventArgs) {
console.log("user defined event: " + eventName, mapModel, originalEventArgs);
var e = originalEventArgs[0];
_scope.$apply();
}
}
};
<ui-gmap-google-map center="map.center" zoom="map.zoom"></ui-gmap-google-map>
I doesn't work like this and I don't know what to do. I would like to be able to get the coordinates of the clicked location. Thnx
Upvotes: 4
Views: 3331
Reputation: 17647
You didn't bind event
property of <ui-gmap-google-map>
directive to the variable (associative array) map.events...
So you should do:
<ui-gmap-google-map center="map.center" events="map.events" zoom="map.zoom"></ui-gmap-google-map>
Upvotes: 3