Using the Google maps JS API. When calling InfoWindow.open(map, marker); you may come across the following error:
Uncaught TypeError: a.lat is not a function
This is caused by setting the position property in the map options object.
var myLatLng = {
lat: 41.771312,
lng: -48.427734
};
var myMap = new mapsApi.Map({
// This will cause the error
position: myLatLng
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Some Marker'
});
var infoWindow = new mapsApi.InfoWindow({
content: 'foo'
});
infoWindow.open(map, myMarker);I have no idea why this is an issue but I bashed my head into this and it was really annoying to figure out what went wrong. Luckily version control ftw to narrow down what changes caused this.
I'm facing with the same issue, but thank you for your explanation. I just commented this line.
And, I think that position argument isn't need in this case, I used center argument.