EP 11.2 - Angular / HTTP / Core HTTP API Setup & Usage

Опубликовано: 26 Декабрь 2018
на канале: jawache
16,691
46

📚 Read the book 👉 https://go.asim.dev/angular-book
🔥 Level up your JavaScript 👉 https://go.asim.dev/advjs
🌿 If you find my videos useful please consider planting a tree for me 👉 https://go.asim.dev/trees
🎥 Watch the full playlist 👉 https://go.asim.dev/angular-playlist

The best place to view the code associated with this course is in the online book (https://go.asim.dev/angular-book) via the book if a lecture has code associated with it, it then also has a link to a stackblitz instance so you can run and edit the code sample online.


We inject the Http client library into our classes, it’s a dependency that needs to be configured in Angulars DI framework.

Rather than separately setting up each provider for all the different parts of the Http client library, we can instead import the HttpModule and add to our NgModule imports list. This sets up the injector on our NgModule with all the necessary providers.

We make requests for all the HTTP verbs by calling matching functions on our Http client library.

By default these requests return observables which we can subscribe to, we can also convert these observables into promises and handle the asynchronous responses that way.

We handle errors using the typical observable or promise error handlers.

We send custom headers alongside our requests by passing in an appropriately configured RequestOptions object to our HTTP functions.

This lecture covered the basics of using the HTTP client library, in the next lecture we’ll go through a specific example using promises.


На этой странице сайта вы можете посмотреть видео онлайн EP 11.2 - Angular / HTTP / Core HTTP API Setup & Usage длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь jawache 26 Декабрь 2018, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 16,691 раз и оно понравилось 46 зрителям. Приятного просмотра!