This repository was archived by the owner on Nov 30, 2018. It is now read-only.
This repository was archived by the owner on Nov 30, 2018. It is now read-only.
Uncaught TypeError: $scope.map.control.getGMap is not a function when click on Map #1736
Open
Description
I am working on Angular-Google-MAP. I want to added marker to map. But when I click on Map, I am getting error $scope.map.control.getGMap is not a function
. This is defined in geocodePosition()
, when Map click even called. Please let me know why it is not working....
<ui-gmap-google-map center='map.center' zoom='map.zoom' control='map.control' id="map-canvas" events="map.events">
<ui-gmap-markers models="markers" idkey="markers.id" coords="'coords'" events="markerEvents" icon="'icon'">
</ui-gmap-markers>
</ui-gmap-google-map>
In controller
function MapController($scope, GMapReady, GoogleMapApi, $timeout) {
GMapReady.promise().then(
var map={
center: {
latitude: 21.1458004,
longitude: 79.08815460000005
},
bounds : {northeast : { latitude : 79.08815460000005, longitude : 79.08815460000005},
southwest : { latitude : 79.08815460000005, longitude : 79.08815460000005}},
zoom: 5,
control : {}
};
$scope.map=map;
$scope.map.events ={
click: function(map, eventName, originalEventArgs){
var e=originalEventArgs[0];
var lat=e.latLng.lat(),lon=e.latLng.lng();
var latlng = new google.maps.LatLng(lat, lon);
geocodePosition(latlng);
}
}// end of Map event
);
function geocodePosition(pos){
.....some code .......
......................
var map_obj=$scope.map.control.getGMap();
var service = new google.maps.places.PlacesService(map_obj);
};
}