Introducing the Angular HTTP client
The HTTP client of the Angular framework is a separate Angular library that resides in the @angular/common
npm package under the http
namespace. The Angular CLI installs this package by default when creating a new Angular project.
You will need the source code of the Angular application we created in Chapter 6, Reactive Patterns in Angular, to follow along with the rest of the chapter. After you get the code, we suggest you remove the key-logger
folder for simplicity.
To start using the Angular HTTP client, we need to import the provideHttpClient
method in the app.config.ts
file:
import { provideHttpClient } from '@angular/common/http';
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection...