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 3 years ago

Answers (1)

Add Answer
Shahjaha Shaikh Marked As Accepted
Staff answered 3 years ago

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

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

 

Subscribe

Select Categories