-
Notifications
You must be signed in to change notification settings - Fork 817
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(AgmCoreModule): support loader config
Closes #609
- Loading branch information
1 parent
05544d5
commit dba6a36
Showing
2 changed files
with
41 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {ModuleWithProviders, NgModule, Provider, provide} from '@angular/core'; | ||
|
||
import {SebmGoogleMap} from './directives/google-map'; | ||
import {SebmGoogleMapCircle} from './directives/google-map-circle'; | ||
import {SebmGoogleMapInfoWindow} from './directives/google-map-info-window'; | ||
import {SebmGoogleMapMarker} from './directives/google-map-marker'; | ||
import {SebmGoogleMapPolyline} from './directives/google-map-polyline'; | ||
import {SebmGoogleMapPolylinePoint} from './directives/google-map-polyline-point'; | ||
import {LazyMapsAPILoader} from './services/maps-api-loader/lazy-maps-api-loader'; | ||
import {LazyMapsAPILoaderConfigLiteral, provideLazyMapsAPILoaderConfig} from './services/maps-api-loader/lazy-maps-api-loader'; | ||
import {MapsAPILoader} from './services/maps-api-loader/maps-api-loader'; | ||
import {BROWSER_GLOBALS_PROVIDERS} from './utils/browser-globals'; | ||
|
||
const CORE_DIRECTIVES: any[] = [ | ||
SebmGoogleMap, SebmGoogleMapMarker, SebmGoogleMapInfoWindow, SebmGoogleMapCircle, | ||
SebmGoogleMapPolyline, SebmGoogleMapPolylinePoint | ||
]; | ||
|
||
/** | ||
* The angular2-google-maps core module. Contains all Directives/Services/Pipes | ||
* of the core module. Please use `AgmCoreModule.forRoot()` in your app module. | ||
*/ | ||
@NgModule({declarations: CORE_DIRECTIVES, exports: CORE_DIRECTIVES}) | ||
export class AgmCoreModule { | ||
/** | ||
* Please use this method when you register the module at the root level. | ||
*/ | ||
static forRoot(lazyMapsAPILoaderConfig?: LazyMapsAPILoaderConfigLiteral): ModuleWithProviders { | ||
const providers: Provider[] = | ||
[...BROWSER_GLOBALS_PROVIDERS, provide(MapsAPILoader, {useClass: LazyMapsAPILoader})]; | ||
if (lazyMapsAPILoaderConfig) { | ||
providers.push(provideLazyMapsAPILoaderConfig(lazyMapsAPILoaderConfig)); | ||
} | ||
return { | ||
ngModule: AgmCoreModule, | ||
providers: providers, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters