In an Angular reactive form, how can you dynamically add a validator to a form control at runtime?

  • Create a new FormControl instance with the validator
  • It's not possible to add validators at runtime
  • Use the 'Validators' service
  • Use the 'setValidators' method
To dynamically add a validator to a form control in an Angular reactive form, you should use the 'setValidators' method to set the validators for the form control, allowing you to change the validation rules at runtime.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *