Error: No provider for HttpHandler in angular2
Add HttpClientModule to your imports[] in app.module.ts. This might be one of the mistakes.
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
],
...