Created
December 25, 2018 14:39
-
-
Save chsami/a854ff2e25b13a844919f35c0a2b989e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//Use the InjectionToken for the mapsConfig, this can be later used to inject it with DI | |
export const MapsConfig = new InjectionToken<IMapsConfig>('MAPS_CONFIG'); | |
@Injectable({ | |
providedIn: MapModule | |
}) | |
export class MapService { | |
private _key: string; | |
constructor( | |
@Optional() @Inject(MapsConfig) config: IMapsConfig = null | |
) { | |
if (config) { | |
this._key = config.key; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment