-
Notifications
You must be signed in to change notification settings - Fork 50
I get the error, Can't find variable: google when page auto-reloads after making a save #22
Copy link
Copy link
Open
Description
I get the error, Can't find variable: google in my browser console when the page auto-reloads after making a save, however when I reload the page in the browser manually, it usually loads fine, but not always.
Could this mean that it's trying to run the script before it's loaded the js?
This is my code;
@ViewChild('gmap') gmapElement: any;
map: google.maps.Map;
and then inside ngOnInit() {, I assign the lat/long to a variable, the styles, the marker image, and then the following:
var mapProp = new google.maps.Map(this.gmapElement.nativeElement, {
zoom: 15,
center: myPosition,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: myMapStyles
});
var marker = new google.maps.Marker({
position: myPosition,
map: mapProp,
icon: mapMarkerImage,
title: 'Temporary Title'
});
var contentString = '<h3 class="sectiontitle fc-darkshade">Temporary popup title</h3>'+
'<div class="fc-darkshade">'+
'<p>Some details here or address?</p>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
marker.addListener('click', function() {
infowindow.open(mapProp, marker);
});
Any help is appreciated
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels