Reputation: 745
I am using angular-google-map.js. And i am getting error in my console window repeatedly.
TypeError: Cannot read property 'gManager' of undefined
at Object.fn (ui-googlemap.js:10)
at n.$digest (angular.min.js:123)
at angular.min.js:126
at e (angular.min.js:40)
at angular.min.js:44
How can i deal with? My Code Html File
<div id="map-canvas">
<ui-gmap-google-map center='map.center' zoom='map.zoom'>
<ui-gmap-markers models="markerList" coords="'self'" idkey="'intClientID'">
</ui-gmap-markers>
</ui-gmap-google-map>
And controller file is
$scope.map = {
center: {
latitude: $scope.lat,
longitude: $scope.long
},
zoom: 11,
markers: [], // array of models to display
markersEvents: {
click: function (marker, eventName, model, arguments) {
$scope.map.window.model = model;
$scope.map.window.show = true;
}
},
window: {
marker: {},
show: false,
closeClick: function () {
this.show = false;
},
options: {} // define when map is ready
}
};
$scope.markerList = /* Service call to get marker point */
markerList get form the service.
Upvotes: 0
Views: 1909
Reputation: 1092
I know this is an old one but I would like to bring my experience. In my case this issue was solved initializing the markerList variable.
While angular-google-maps creates the Markers object, needs to know the length of the array of markers (even if it is 0) and this process breaks if the array is undefined.
So just add
$scope.markerList = [];
at the first lines of your controller.
Upvotes: 1
Reputation: 6661
I had this same issue. I was missing the pan
attribute, which the documentation specifies is required. After adding the pan
attribute, the error went away.
Upvotes: 0