Search code examples
angularformsformbuilderform-controlformgroups

How do I add Validations to dynamically created FormControls?


I am creating dynamic FormArray and FormGroups. In which I am creating formControl with .addControl(). How Do I add validations for controls, which can be required, phone number, email, etc.


Solution

  • You can use setValidators([Validators.required]) and every other validation you might want to add.