import { Injectable } from '@angular/core' ; import { HttpEvent , HttpHandler , HttpInterceptor , HttpRequest } from '@angular/common/http' ; import { Observable } from 'rxjs' ; import { finalize } from 'rxjs/operators' ; import { FullscreenLoadingService } from '../fullscreen-loading.service' ; @ Injectable ( ) export class FullscreenLoadingInterceptor implements HttpInterceptor { constructor ( private fullscreenLoadingService ) { } intercept ( req , next ) { return next . handle ( req ) . pipe ( finalize ( ( ) => this . fullscreenLoadingService . hide ( ) ) ) ; } }