Skip to content

Instantly share code, notes, and snippets.

@changhuixu
Created July 26, 2020 02:47
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 changhuixu/a654a11e0ecb839ff469c46227a1d05b to your computer and use it in GitHub Desktop.
Save changhuixu/a654a11e0ecb839ff469c46227a1d05b to your computer and use it in GitHub Desktop.
@NgModule({
declarations: [],
imports: [CommonModule],
providers: [
{
provide: APP_INITIALIZER,
useFactory: appInitializer,
multi: true,
deps: [AuthService],
},
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
{
provide: HTTP_INTERCEPTORS,
useClass: UnauthorizedInterceptor,
multi: true,
},
],
})
export class CoreModule {
constructor(@Optional() @SkipSelf() core: CoreModule) {
if (core) {
throw new Error('Core Module can only be imported to AppModule.');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment