Skip to content

Instantly share code, notes, and snippets.

@cironunes
Created September 6, 2017 16:16
Show Gist options
  • Save cironunes/e8d586e3124799b58159a1a011037dae to your computer and use it in GitHub Desktop.
Save cironunes/e8d586e3124799b58159a1a011037dae to your computer and use it in GitHub Desktop.
Loading interceptor
import { HttpInterceptor, HttpEvent, HttpRequest, HttpHandler } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
export class LoadingInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const loadingReq = req.clone({
reportProgress: true
});
return next.handle(loadingReq);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment