ERROR NullInjectorError: R3InjectorError(AppModule)[HttpClient -> HttpClient -> HttpClient]: code example
Example 1: NullInjectorError: No provider for HttpClient!
@NgModule({
...
imports:[ HttpClientModule ]
...
})
Example 2: No provider for HttpClient!
import { HttpClientModule } from '@angular/common/http';
Example 3: NullInjectorError: R3InjectorError HttpClient
// missing import on app.module.ts
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
HttpClientModule
]