In my app, after click on the google map, I need to get the lat and lng information for further handling. And since the app use angualrjs as the frame, so i used the google map angular as. the coding is as following:
$scope.map = {
center: {
latitude: 37.782551,
longitude: -122.445368
},
zoom: 12,
heatLayerCallback: function (layer) {
MockHeatLayer(layer);
},
showHeat: true,
// the issue is from here
onclick: {
click : function(maps, event, arguments) {
console.log(event.latLng); //return undefined
console.log(typeof(event)); //return string type instead of event object
}
}
};
})
and HTML tag is as following:
<ui-gmap-google-map center='map.center' zoom='map.zoom' events='map.onclick'>
<ui-gmap-layer namespace="visualization" type="HeatmapLayer" show="map.showHeat" onCreated="map.heatLayerCallback"></ui-gmap-layer>
</ui-gmap-google-map>
as you can see, set the events to onclick in the map array.
But after debugging, the the event in the handle function is a string instead of object, so what is the problem?