Arman Gevorgyan
Arman Gevorgyan

Reputation: 281

Set invalid status to reactive form control

I'm trying to set a form control status to invalid, but this example doesn't work

this.currencyForm.controls['currencyMaxSell'].setErrors({smallerThan: true})

Upvotes: 3

Views: 10211

Answers (1)

karoluS
karoluS

Reputation: 3218

I don't know why would anyone like to set formControl as invalid witout a validator but here's how you do this this.myForm.controls['mycontrolname'].setErrors({});.

You should use validators and set control invalid this way

Upvotes: 2

Related Questions