Here we continue the process to complete our nested star/review component. Reynald demos how to update the directives and modify the template's component so it knows where to find this directive. He also shows how to add the directive property to the object passed into the component decorator and finally show the result.
- View Offline
- Exercise Files
- [Instructor] So we began writing the code in order…to convert our review ratings from a numerical format…to an image of stars.…So let's go ahead and continue this by nesting…that component that we built.…The first thing that we're going to want to do…is to open up our template,…our movie-list.component.html,…and navigate down to the section where we have…our movie properties that we…reference through interpolation,…and we're going to replace the property…movie.starRating with a directive md-review.…
The next thing to do is to update the template…component so it knows where to find this directive.…And we do that by going to our component,…movie-list.component.ts,…so let's open that up and at the very top…let's go ahead and add an import statement…for the review component that's going to be used.…Following this, we need to add a directive's property…that allows Angular to use a directive…and we're going to assign it ReviewComponent, okay.…
So now let's go ahead and save,…and let's run the application and see what we get.…
- Creating components
- Bootstrapping components
- Working with templates
- Using directives and interpolation
- Binding and transforming data
- Creating advanced and nested components
- Creating services
- Obtaining data with HTTP calls
- Configuring routes
Skill Level Intermediate
1. Course Overview
3. Directives, Interpolation, and Templates
5. Advanced Components
7. Obtaining Data with HTTP
- 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.