I have a core module in which I define two HTTP interceptors. Like this:
@NgModule({
imports: [...],
declarations: [...],
exports: [...],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: BasicAuthInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: CoreInterceptor, multi: true },
...
],
})
export class CoreModule {}
This works well. The interceptors are called in my entire application and do their job. Now I wanted to extend a module of my application with another interceptor.
@NgModule({
imports: [...],
declarations: [...],
exports: [...],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: EventInterceptor, multi: true },
...
],
})
export class ApplicationModule {}
As soon as I include the EventInterceptor, the interceptors from my CoreModule are no longer called. Of course I could now also include BasicAuthInterceptor and CoreInterceptor in my ApplicationModule. However, I would like to avoid that.
What am I doing wrong?