All our data binding so far has only been one way. Sometimes we want it to be two ways like when handling user events. Like to invoke an operation when a user clicks a button. Our goal here is to implement functionality to hide/show poster button with event binding on our movie database application.
- View Offline
- Exercise Files
- [Instructor] All our data binding…so far has been one way.…Sometimes we want it to be two ways…like when we're handling user events.…Like to invoke an operation when a user clicks a button.…Currently our show poster button doesn't do anything.…Let's go ahead and add some Logic…so that we can either hide or display these movie posters.…The way we're going to be doing…this is by using event binding.…So let's go ahead and navigate to our…movie-list.component.ts file.…
Which I'm currently on right now…and we are going to define a simply property…to keep the value of true or false…whether or not to see the movie poster.…And we can go ahead and paste that in…right below image margin.…The default value will be false.…The next thing we want to do is to create…a method that the event binding will call.…So let's place this after all the properties…to follow convention.…We could place this right before the last…curly brace at the end of the page.…
So the method name will be toggle image…and it will simply, as the name implies,…
- 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.