Skip to content

Instantly share code, notes, and snippets.

@SaurabhLpRocks
Created October 29, 2017 02:08
Show Gist options
  • Select an option

  • Save SaurabhLpRocks/ba8a9cd00ecd5dc56996af97159f2306 to your computer and use it in GitHub Desktop.

Select an option

Save SaurabhLpRocks/ba8a9cd00ecd5dc56996af97159f2306 to your computer and use it in GitHub Desktop.
export class AppModule {
/**
* Allows for retrieving singletons using `AppModule.injector.get(MyService)`
* This is good to prevent injecting the service as constructor parameter.
*/static injector: Injector;
constructor(public appState: AppState, injector: Injector) {
AppModule.injector = injector;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment