The Http Interceptor is an interface and used to implement the intercept method. ü Stayed Informed - How To Set Authorization Headers in GET/POST Requests? Example - //Register an Interceptor (HTTP_INTERCEPTORS) in the app Module. import { NgModule } from '@angular/core' ; import { HTTP_INTERCEPTORS } from '@angular/common/http' ; @ NgModule ({ providers: [{ provide: HTTP_INTERCEPTORS , useClass: MyInterceptor , multi: true , }], }) export class AppModule {} And //The HttpInterceptor is an interface and used to implement the intercept method. import { Injectable } from '@angular/core' ; import { HttpEvent , HttpInterceptor , HttpHandler , HttpRequest } from '@angular/common/http' ; @ Injectable () export class MyInterceptor implements HttpInterceptor { intercept ( req : HttpRequest < any >, next : HttpHandler ): Observable ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers