[英]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. 表单控件名称是postalCode,当我将错误设置为null时,它不会从该控件中删除错误。
尝试做this.form.controls ['postalCode']。setErrors({});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.