NullInjectorError: No provider for HttpClient!

Sat, Feb 15, 2020

Read in 1 minutes

Introduction

In this article, we will see how to solve the NullInjectorError: No provider for HttpClient!

Solution for this Error :

When you use “HttpClient” in your component (import { HttpClient } from ‘@angular/common/http’;) ,you have add this in your app.module.ts file.

Add the below import in app.module.ts file

import { HttpClientModule } from @angular/common/http;

And in the imports section add the HttpClientModule.

imports: [ BrowserModule, HttpClientModule ],