Question - What is Data Binding? In how many ways can it be executed?
Answer -
Data binding is used to connect application data with the DOM (Data Object Model). It happens between the template (HTML) and component (TypeScript). There are 3 ways to achieve data binding:
- Event Binding: Enables the application to respond to user input in the target environment.
- Property Binding: Enables interpolation of values computed from application data into the HTML.
- Two-way Binding: Changes made in the application state get automatically reflected in the view and vice-versa. The ngModel directive is used for achieving this type of data binding.