HTTP

Any Angular application that needs to communicate with the backend using REST services needs an HTTP client. Angular comes with its own HTTP library; it is available in the @angular/http npm package.

Before we start learning about the HTTP library, we need an application where we can use it. We are going to use Angular CLI to create our project; before getting started, make sure that you have Angular CLI installed on your machine.

Run the following command to install Angular CLI:

$ npm install -g @angular/cli@latest

Run the following command to create an Angular project using CLI:

$ ng new http-client-basics

The preceding command will create the Angular application with all the required libraries and tooling. Now navigate to our ...

Get Building Modern Web Applications using Angular now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.