I am currently using Angular 18 for my application and my application is modular-based. Previously, my application was developed using Angular 16, but I have recently upgraded it to Angular 18. However, after the upgrade, I have encountered an issue where the interceptor in my application is no longer functioning as expected.
Here is my app-module code
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NZ_I18N, en_US } from 'ng-zorro-antd/i18n';
import { registerLocaleData, PathLocationStrategy,
LocationStrategy } from '@angular/common';
import en from '@angular/common/locales/en';
import { AppComponent } from './app.component';
import { CommonLayoutComponent } from './layouts/common-
layout/common-layout.component';
import { ThemeConstantService } from './shared/services/theme-
constant.service';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { AuthInterceptor } from './auth/services/auth-
interceptor.service';
registerLocaleData(en);
@NgModule({
declarations: [
AppComponent,
CommonLayoutComponent,
],
imports: [
BrowserModule,
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: AuthInterceptor,
multi: true,
},
{
provide: NZ_I18N,
useValue: en_US,
},
{
provide: LocationStrategy,
useClass: PathLocationStrategy
},
ThemeConstantService
],
bootstrap: [AppComponent]
})
export class AppModule {}
1