#native_company# #native_desc#
#native_cta#

Wrapping Up

We use the Http client library in Angular to make HTTP requests.

We use the library by injecting it into classes and as such it needs to be configured via Anuglars DI framework.

To setup all the necessary providers we just need to import the HttpModule and add it to the imports property of our NgModule.

When architecting Angular application we don’t call the Http library directly from components but instead create intermediate services which call the APIs on our behalf.

We also also prefer to convert the responses into domain models and return those instead of the raw response from the API.

The request functions return Observables, we can implement any required processing by using an observable chain or we can convert the observable into promises and handle the processing in a more classically procedural way.

We can use JSONP to bypass CORS with supported APIs, to do we we just need to replace instances of Http with Jsonp and HttpModule with JsonpModule.


Caught a mistake or want to contribute to the book? Edit this page on GitHub!



Advanced JavaScript

This unique course teaches you advanced JavaScript knowledge through a series of interview questions. Bring your JavaScript to the 2021's today.

Level up your JavaScript now!