ngmodel
ngModel is a directive in Angular that enables two-way data binding between a form control and a component property in template-driven forms. It connects the value of input, select, or textarea elements to a corresponding field in the component, so user input updates the model and changes to the model reflect in the view.
To use ngModel, the FormsModule must be imported in the application module. In templates, two-way binding is
ngModel supports optional configuration through ngModelOptions, including updateOn to control when the value is updated (for
Within template-driven forms, ngModel creates a form control that exposes properties such as valid, invalid, touched,
ngModel is commonly used for simple forms and straightforward two-way bindings, but it is less suited for