
Two-way binding with ngModel
Two-way binding helps us keep the model and view in sync. Changes to the model update the view and changes to the view update the model. The obvious area where two-way binding is applicable is form input. Let's look at a simple example:
<input [(ngModel)]="workout.name">
The ngModel directive here sets a two-way binding between the input's value property and the workout.name property on the underlying component. Anything that the user enters in the preceding input is synced with workout.name, and any changes to workout.name are reflected back on the preceding input.
Interestingly, we can achieve the same result without using the ngModel directive too, by combining both property and event binding syntax. Consider the next example; it works in the same way as input before:
<input [value]="workout.name" (input)="workout.name=$event.target.value" >
There is a property binding set up on the value property and an event binding set up on the input event that make the bidirectional sync work.
We will get into more details on two-way binding in Chapter 2, Personal Trainer, where we build our own custom workouts.
We have created a diagram that summarizes the data flow patterns for all the bindings that we have discussed thus far. Here is a handy diagram to help you memorize each of the binding constructs and how data flows:

We now have a fully functional 7 Minute Workout, with some bells and whistles too, and hopefully you had fun creating the app. It's time to conclude the chapter and summarize the lessons.