Skip to content

Instantly share code, notes, and snippets.

@GerritRiesch94
Last active July 10, 2023 13:33
Show Gist options
  • Save GerritRiesch94/d9c1517e74b10e4f4fb5c2d0434f89cc to your computer and use it in GitHub Desktop.
Save GerritRiesch94/d9c1517e74b10e4f4fb5c2d0434f89cc to your computer and use it in GitHub Desktop.
Interceptor module common way
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HTTP_INTERCEPTORS, HttpClientModule } from "@angular/common/http";
import { MyInterceptor } from "./my-interceptor";
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule
],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: MyInterceptor, multi: true },
],
bootstrap: [AppComponent]
})
export class AppModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment