I'm using Angular.js
on my website and i'm able to load the map with a pin on a particular geocode with data i'm getting from a GET
request on my server. However, when the user goes to a new page, the map loads...but only partially. The rest of the map is a gray area. My code is below:
data.map.center = new google.maps.LatLng(parseFloat(response.geocode.latitude), parseFloat(response.geocode.longitude));
data.map.mapEnabled = true;
var map_canvas = document.getElementById('map_canvas');
var map_options = {
center: data.map.center,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControl: false,
panControl: false,
scrollwheel: false,
draggable: false,
mapTypeControl: false,
streetViewControl: false
};
data.map.mapObject = new google.maps.Map(map_canvas, map_options);
var marker = new google.maps.Marker({
map: data.map.mapObject,
position: data.map.center
});
Is there a reason the map loads partially on the next page? When I do a refresh it then loads it in full, but why is it not working initially?
I read the following on this:
Google Maps API v3: How to remove all markers?
Google Maps API V3 not rendering competely on tabbed page using Twitter's Bootstrap
EDIT
It seems part of the reason is that i'm not refreshing the page when the user clicks on the second link. I'm only using hashes and then loading it that way... Not sure if there's something I should be doing differently for this?