In this video, learn how to use the @Input decorator and a setter method to capture values when using a directive.
- [Instructor] Okay, time to learn how … you can make your custom directive support input values … from the directive property … that matches the directive selector on the host element. … Let's start by updating the favorite directive … to support using the directive property syntax … with a statement, so we can … use the mwFavorite directive selector … on the media-item element, and set it equal to a statement … that will give us the value … The media-item.component.html file, … is where we have the favorite element, … so we need to wrap the mwFavorite with brackets, … to let Angular know we want to do the binding here. … Then we can set the directive property … equal to mediaItem.isFavorite. … Now we want to capture the value … of the mwFavorite property in the favorite directive. … Remember from a previous lesson how data can be delivered … to components via property bindings … when components make use of the input decorator? … And remember, that a component in Angular, … is just a directive with a template? …
- 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.