You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 30, 2018. It is now read-only.
Angular Google Maps loads the Google Maps API when Angular configures all
modules. This means the API is requested on every page load, which is
undesirable for Google Maps for Work customers who're charged on every page
view.
As outlined in issue
[1604](#1604 (comment))
the ability to delay loading of the API would be beneficial.
This commit adds a new service to the google map API provider as well as a new
configuration option, `preventLoad: true`.
Here's how one would use this new feature to asynchronously load the API at a
later time in the Angular lifecycle:
var app = angular.module('app', ['uiGmapgoogle-maps'])
.config(['uiGmapGoogleMapApiProvider', function(uiGmapGoogleMapApiProvider)
{
var options = { preventLoad: true };
uiGmapGoogleMapApiProvider.configure(options);
}])
.controller('myController', ['$scope', 'uiGmapGoogleMapApi', 'uiGmapGoogleMapApiManualLoader', function($scope, uiGmapGoogleMapApi, uiGmapGoogleMapApiManualLoader) {
window.setTimeout(function() {
uiGmapGoogleMapApiManualLoader.load();
}, 2000);
uiGmapGoogleMapApi.then(function(maps) {
// Standard maps code
});
}])
0 commit comments