Two-way binding gives your app a way to share data between a component class and its template.
The binding goes both ways. If the user changes the value inside the input field,
the AngularJS property will also change its value.
When data in the model changes, the view reflects the change, and when data in the view changes,
the model is updated as well.
Basics of two-way binding:
Two-way binding does two things:
1.Sets a specific element property.
2.Listens for an element change event.
Angular offers a special two-way data binding syntax for this purpose,[()].
The [()] syntax combines the brackets of property binding,[], with the parentheses of event binding,().
The ng-init directive can be used to initialize variables in AngularJS application.
When data in the model changes, the view reflects the change,
and when data in the view changes, the model is updated as well.
Lets see an example:
=>The binding goes both ways called Two-Way Data Binding If the user changes the value inside
the input field, the AngularJS property will also change its value.
=>The ng-model directive can provide type validation for application data (number, e-mail, required).
=>The ng-model directive can provide status for application data (valid, dirty, touched, error).
=>The ng-model directive provides CSS classes for HTML elements, depending on their status.