We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To set a Google Maps API key, you have to write the following code today:
import {provide} from 'angular2/core'; import {ANGULAR2_GOOGLE_MAPS_PROVIDERS, LazyMapsAPILoaderConfig} from 'angular2-google-maps/core'; bootstrap(AppComponent, [ ANGULAR2_GOOGLE_MAPS_PROVIDERS, provide(LazyMapsAPILoaderConfig, {useFactory: () => { let config = new LazyMapsAPILoaderConfig(); config.apiKey = 'mykey'; return config; }}) ])
As this is very verbose, we should add this shortcut, as adding an API key is a very common case:
import {provide} from 'angular2/core'; import {ANGULAR2_GOOGLE_MAPS_PROVIDERS, googleMapsAPIKey} from 'angular2-google-maps/core'; bootstrap(AppComponent, [ ANGULAR2_GOOGLE_MAPS_PROVIDERS, googleMapsAPIKey('myKey') ])
The text was updated successfully, but these errors were encountered:
How about
import {provide} from 'angular2/core'; import {provideGoogleMaps} from 'angular2-google-maps/core'; bootstrap(AppComponent, [ provideGoogleMaps({ apiKey: 'myKey' }) ])
Which returns an array including ANGULAR2_GOOGLE_MAPS_PROVIDERS and the config object.
It's even more concise, and the "options-style" object could be extended when/if more configuration is needed down the line.
Sorry, something went wrong.
You gave me food for thought :)
I researched how other angular 2 related libraries handle the providers stuff. I discovered the angularfire2 and really makes sense to me:
https://github.com/angular/angularfire2/blob/master/docs/5-user-authentication.md#configure-application-in-bootstrap
So I propose this way:
import {provide} from 'angular2/core'; import {lazyMapsAPILoaderConfig} from 'angular2-google-maps/core'; bootstrap(AppComponent, [ GOOGLE_MAPS_PROVIDERS, lazyMapsAPILoaderConfig({ apiKey: 'myKey' }) ])
Yeah I like that too - it's clean & clear API!
997aa80
sebholstein
No branches or pull requests
To set a Google Maps API key, you have to write the following code today:
As this is very verbose, we should add this shortcut, as adding an API key is a very common case:
The text was updated successfully, but these errors were encountered: