UNPKG

1.94 kBPlain TextView Raw
1import {ModuleWithProviders, NgModule} from '@angular/core';
2
3import {SebmGoogleMapKmlLayer} from './directives/google-map-kml-layer';
4import {SebmGoogleMap} from './directives/google-map';
5import {SebmGoogleMapCircle} from './directives/google-map-circle';
6import {SebmGoogleMapInfoWindow} from './directives/google-map-info-window';
7import {SebmGoogleMapMarker} from './directives/google-map-marker';
8import {SebmGoogleMapPolygon} from './directives/google-map-polygon';
9import {SebmGoogleMapPolyline} from './directives/google-map-polyline';
10import {SebmGoogleMapPolylinePoint} from './directives/google-map-polyline-point';
11import {LazyMapsAPILoader} from './services/maps-api-loader/lazy-maps-api-loader';
12import {LAZY_MAPS_API_CONFIG, LazyMapsAPILoaderConfigLiteral} from './services/maps-api-loader/lazy-maps-api-loader';
13import {MapsAPILoader} from './services/maps-api-loader/maps-api-loader';
14import {BROWSER_GLOBALS_PROVIDERS} from './utils/browser-globals';
15
16/**
17 * @internal
18 */
19export function coreDirectives() {
20 return [
21 SebmGoogleMap, SebmGoogleMapMarker, SebmGoogleMapInfoWindow, SebmGoogleMapCircle,
22 SebmGoogleMapPolygon, SebmGoogleMapPolyline, SebmGoogleMapPolylinePoint, SebmGoogleMapKmlLayer
23 ];
24};
25
26/**
27 * The angular2-google-maps core module. Contains all Directives/Services/Pipes
28 * of the core module. Please use `AgmCoreModule.forRoot()` in your app module.
29 */
30@NgModule({declarations: coreDirectives(), exports: coreDirectives()})
31export class AgmCoreModule {
32 /**
33 * Please use this method when you register the module at the root level.
34 */
35 static forRoot(lazyMapsAPILoaderConfig?: LazyMapsAPILoaderConfigLiteral): ModuleWithProviders {
36 return {
37 ngModule: AgmCoreModule,
38 providers: [
39 ...BROWSER_GLOBALS_PROVIDERS, {provide: MapsAPILoader, useClass: LazyMapsAPILoader},
40 {provide: LAZY_MAPS_API_CONFIG, useValue: lazyMapsAPILoaderConfig}
41 ],
42 };
43 }
44}