Skip to content

Instantly share code, notes, and snippets.

@chsami
Created December 25, 2018 14:42
Show Gist options
  • Save chsami/47d29c9e410f4dcb2fdb874f002e909f to your computer and use it in GitHub Desktop.
Save chsami/47d29c9e410f4dcb2fdb874f002e909f to your computer and use it in GitHub Desktop.
export class MapModule {
//create a static function with the mapConfig as a parameter
static forRoot(mapConfig: IMapsConfig): ModuleWithProviders {
return {
ngModule: MapModule,
//We provide a MapsConfig InjectionToken, which we later can use in our service to use
providers: [ {provide: MapsConfig, useValue: mapConfig} ]
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment