ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(DineOutModule)[RestaurantsService -> RestaurantsService -> HttpClient -> HttpClient -> HttpClient]: NullInjectorError: No provider for HttpClient! in angular code example

Example 1: angular No provider for HttpClient

// open the root app.module.ts,
import { HttpClientModule } from '@angular/common/http';

// add it to the @NgModule.imports array.
imports:[HttpClientModule,  ]

Example 2: NullInjectorError: No provider for HttpClient!

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