Which directive is used in template-driven forms to track the state and validity of form controls?
- [formGroup]
- [formControl]
- [ngModel]
- [formStatus]
In template-driven forms, the [ngModel] directive is used to track the state and validity of form controls. It allows you to access information about the control's state, such as whether it's valid, touched, or dirty. This is crucial for implementing form validation and displaying error messages based on the control's state. The other options, [formGroup] and [formControl], are typically used in reactive forms.
Loading...
Related Quiz
- In multi-slot content projection, how can you differentiate between the different content slots?
- In the context of lazy loading, what is the significance of the canLoad route guard?
- The component where the child route should get rendered must contain the ________ directive in its template.
-
Consider a scenario where you have multiple
slots in a component. How can you ensure that specific content from a parent component is projected into the right slot? - In the Angular route configuration, the children property is used to define ________.