To resolve this problem HttpClient
is Angular’s mechanism for communicating with a remote server over HTTP.
To make HttpClient
available everywhere in the app,
-
open the root
AppModule
, -
import the
HttpClientModule
from@angular/common/http
,import { HttpClientModule } from '@angular/common/http';
-
add it to the
@NgModule.imports
array.imports:[HttpClientModule, ]