如何在 angular 中设置自定义错误非常清楚:
this.form.controls['field'].setErrors({same:true});
Run Code Online (Sandbox Code Playgroud)
但目前尚不清楚如何删除它。有人知道怎么做吗?任何替代方案?
this.form.controls['field'].updateValueAndValidity();
Run Code Online (Sandbox Code Playgroud)
这是方法文档:
/**
* Re-calculates the value and validation status of the control.
*
* By default, it will also update the value and validity of its
ancestors.
*/
updateValueAndValidity({onlySelf, emitEvent}: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {... }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10193 次 |
| 最近记录: |