Provide api key to map
At the time of this writing (or earlier) it seems google requires an api key when using the map.
https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error
How do we pass the key to the map?
Hi,
To pass the key to google map API, I used to override the gmLibraryProvider:configure url property.
Not sure if it's the good way or if there's another way to do this.
myApp.config(['gmLibraryProvider', function (gmLibraryProvider) {
gmLibraryProvider.configure({
language: 'en',
url: 'https://maps.googleapis.com/maps/api/js?key=[YourAPiKey]&' // need to keep the `&` at end of string, if my memories are right
});
}])
I'll try it out, thanks for the suggestion
Hi, go to angular-google-maps-native.js and find:
angular.module('GoogleMapsNative', [])
.provider('gmLibrary', function() {
var deferred,
loading = false,
ignore = ['url', 'libraries'],
options = {
url: 'https://maps.googleapis.com/maps/api/js',
v: 3,
libraries: [],
language: 'en',
callback: '__mapLibraryLoaded'
};
just add your API key :
.provider('gmLibrary', function() { var deferred, loading = false, ignore = ['url', 'libraries'], options = { url: 'https://maps.googleapis.com/maps/api/js', v: 3, libraries: [], language: 'en', callback: '__mapLibraryLoaded', key: "............................." };