Skip to content

Instantly share code, notes, and snippets.

@walidum
Last active April 30, 2021 18:24
Show Gist options
  • Save walidum/5f85c3feacd53e656b82c8315c6a7b89 to your computer and use it in GitHub Desktop.
Save walidum/5f85c3feacd53e656b82c8315c6a7b89 to your computer and use it in GitHub Desktop.
app.module.ts interceptors
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { AppComponent } from './app.component';
import { appRoutingModule } from './app.routing';
import { AuthInterceptor, ErrorInterceptor } from './_helpers';
@NgModule({
imports: [
BrowserModule,
ReactiveFormsModule,
HttpClientModule,
appRoutingModule
],
declarations: [
AppComponent
],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, 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