How do you set default values for controls in a reactive form?
- Default values cannot be set in reactive forms.
- Use the default property of the FormControl.
- Use the setValue method of the FormControl.
- Use the value property of the FormControl.
In reactive forms, you set default values for controls by using the value property of the FormControl object. This property allows you to specify the initial value of the control. You can also use the setValue method to set the value programmatically after the control has been created. The default property is not used for setting default values in reactive forms.
Loading...
Related Quiz
- How can you implement custom validators in a template-driven form?
- The process of retrieving previous navigation details, such as the previously visited route, can be achieved using router.________ in Angular.
- How can you project content from a parent component into a child component's template?
- Which Angular decorator is used to define a component's metadata?
- In which scenario is it NOT recommended to use ChangeDetectionStrategy.OnPush?