In this video, learn how to use the HttpClient service to make HTTP GET calls to retrieve data.
- [Presenter] Angular has a class named HttpClient, … that is a service for making http request calls … and returning http responses. … Let's refactor the mediaItems service class … to use the HttpClient class to make a get request … for the mediaItems. … we need to start by importing HttpClient … from @angular/common/http. … (typing) … Then we need a constructor that takes in http, … adding the typescript access modifier of private, … to take advantage of the property initialization shortcut … and setting the type to HttpClient. … (typing) … Now we can refactor the get method to call this.http.get. … (typing) … The get method expects a URL at a minimum. … The mock back-in is designed to support the URL mediaItems, … We need to unwrap the http response objects … that the http get method sends back, … because we still want the service to return mediaItems … not an http response object … that the component has to deal with. … So we need to import that operator first, … which we do with an import statement of …
- What is Angular?
- Working with components
- Binding events and properties
- Getting data to components
- Using directives and pipes
- Creating Angular forms
- Validating form data
- How Angular does dependency injection
- Making HTTP calls
- Styling components
Skill Level Intermediate
Angular: Building an Interfacewith Ray Villalobos2h 20m Intermediate
1. Architecture Overview
3. Directives and Pipes
5. Dependency Injection and Services
8. Styling Components
Next steps1m 20s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.