Skip to content

Commit 8d6ed16

Browse files
committed
fix(map-loader): change includeScript to place maps api script tag to head element instead of body
Placing the script tag in document body causes the Google Maps API to be included multiple times when document is stored using the History API and then later retrieved (e.g. when using Turbolinks.js). Placing the script tag inside head element solves this problem, ensuring the Google Maps API is loaded only once.
1 parent f18753d commit 8d6ed16

13 files changed

+44
-44
lines changed

dist/angular-google-maps-street-view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! angular-google-maps 2.3.3 2016-06-03
1+
/*! angular-google-maps 2.3.3 2016-07-16
22
* AngularJS directives for Google Maps
33
* git: https://github.com/angular-ui/angular-google-maps.git
44
*/
@@ -109,7 +109,7 @@ return UUID;
109109
script.id = scriptId = "ui_gmap_map_load_" + (uuid.generate());
110110
script.type = 'text/javascript';
111111
script.src = getScriptUrl(options) + query;
112-
return document.body.appendChild(script);
112+
return document.head.appendChild(script);
113113
};
114114
isGoogleMapsLoaded = function() {
115115
return angular.isDefined(window.google) && angular.isDefined(window.google.maps);

dist/angular-google-maps-street-view.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps-street-view_dev_mapped.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps-street-view_dev_mapped.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps-street-view_dev_mapped.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps-street-view_dev_mapped.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! angular-google-maps 2.3.3 2016-06-03
1+
/*! angular-google-maps 2.3.3 2016-07-16
22
* AngularJS directives for Google Maps
33
* git: https://github.com/angular-ui/angular-google-maps.git
44
*/
@@ -96,7 +96,7 @@ Nicholas McCready - https://twitter.com/nmccready
9696
script.id = scriptId = "ui_gmap_map_load_" + (uuid.generate());
9797
script.type = 'text/javascript';
9898
script.src = getScriptUrl(options) + query;
99-
return document.body.appendChild(script);
99+
return document.head.appendChild(script);
100100
};
101101
isGoogleMapsLoaded = function() {
102102
return angular.isDefined(window.google) && angular.isDefined(window.google.maps);

dist/angular-google-maps.min.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps_dev_mapped.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps_dev_mapped.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)