简体   繁体   中英

Angular Clear form control errors

How to clear the errors on form control. I have a method that tries to clear the errors on the form control but in vain.

this.form.controls[ 'postalCode' ].setErrors(null);

The form control name is postalCode and when I set the error to null, it doesn't remove the error from that control.

尝试做this.form.controls ['postalCode']。setErrors({});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM