How to manually set the error in form field in Angular?

Forums AngularHow to manually set the error in form field in Angular?
Staff asked 1 month ago

Answers (1)

Add Answer
Shahjaha Shaikh Marked As Accepted
Staff answered 1 month ago

You can set the error on the field by writing this code.

formName.controls[controlName].setErrors({'incorrect': true});

 

Subscribe

Select Categories