Skip to content

Instantly share code, notes, and snippets.

@anteburazer
Created June 5, 2017 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anteburazer/997ce2a2903c02594d30635509ea67d2 to your computer and use it in GitHub Desktop.
Save anteburazer/997ce2a2903c02594d30635509ea67d2 to your computer and use it in GitHub Desktop.
import { APP_INITIALIZER } from '@angular/core';
export function configServiceFactory (config: ConfigService) {
return () => config.load()
}
...
@NgModule({
...
providers: [
...
ConfigService,
{
provide: APP_INITIALIZER,
useFactory: configServiceFactory,
deps: [ConfigService],
multi: true
}
],
...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment