I am trying to implement HttpCache through interceptor. Following is the caching-interceptor.service.ts
import { HttpRequest, HttpResponse, HttpInterceptor, Http
HttpClient
is introduced in angular 4.3,so if you want to use HttpClient
you need to import HttpClientModule
from '@angular/common/http'
. Make sure to import HttpClientModule
after BrowserModule
as shown below. This official doc and so answer will give you indepth information.
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
BrowserModule,
HttpClientModule
],
...