docs(aio): add missing imports to interceptor example (#21259)
PR Close #21259
This commit is contained in:
parent
dcc3eba962
commit
03d16fcd24
@ -273,6 +273,8 @@ has a single `intercept()` method. Here is a simple interceptor which does nothi
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/common/http';
|
import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/common/http';
|
||||||
|
|
||||||
|
import {Observable} from 'rxjs/Observable';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NoopInterceptor implements HttpInterceptor {
|
export class NoopInterceptor implements HttpInterceptor {
|
||||||
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
@ -297,6 +299,8 @@ Simply declaring the `NoopInterceptor` above doesn't cause your app to use it. Y
|
|||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {HTTP_INTERCEPTORS} from '@angular/common/http';
|
import {HTTP_INTERCEPTORS} from '@angular/common/http';
|
||||||
|
|
||||||
|
import {NoopInterceptor} from 'noop.interceptor.ts';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
providers: [{
|
providers: [{
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user