DEV Community

Discussion on: Angular Interceptor not working

Collapse
 
carboncs16 profile image
Punya Purba Pattnaik

Please verify the module in which you have added interceptor as a providers. Below is an example how to add interceptor in your respective module.

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    CoreModule,
  ],
  providers: [
    [{ provide: HTTP_INTERCEPTORS, useClass: AppInterceptor, multi: true }]
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Enter fullscreen mode Exit fullscreen mode