Last active
July 10, 2023 13:33
-
-
Save GerritRiesch94/d9c1517e74b10e4f4fb5c2d0434f89cc to your computer and use it in GitHub Desktop.
Interceptor module common way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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