Sometimes, it's convenient to have an HTML element that can both respond to an event and modify a property at the same time. Learn how you can do that with two-way data binding, which combines what you have learned about properties and events.
- [Instructor] Sometimes, it's convenient to have an element…that can both respond to an event and modify a property…at the same time.…Angular gives you a shortcut to do this…that combines both of the techniques…that we've doing so far.…The technique is called two-way data binding…because it's tracking an event and setting a value…at the same time.…So, let's show you how this works…by doing it in two different ways.…So first, I'm going to take this input right here…and I'm going to have it track a value of the name…that we've entered into our component.…
So we have this variable here called name…and it tracks the name of the user.…So in here, we're going to ask the value of that field…to be tracked using our bracket notation…which lets us track a property of a HTML element.…We're in the input field so an input field element is value…and we can set that to the name variable…or the variable that we've called name in our component.…So if we do that, let's go ahead and save this,…you'll notice that we'll immediately get…
In this course, Ray Villalobos shows you how to start using Angular 2 in your own projects. He starts by defining what exactly Angular 2 is and how it differs from AngularJS 1. Then, once the basics are out of the way, he sets up the template that will drive the project and starts coding. Ray shows how to divide your project into modules, work with events, style content with CSS, and create components and subcomponents. Plus, you can find out how to change content dynamically using data pipes.
Note: Members can find a template to download in the exercise files.
- What is Angular 2?
- Setting up a template
- Creating a simple component
- Using multiple modules
- Displaying data in templates
- Working with events
- Creating a subcomponent
- Filtering content through data pipes