我有一个自定义异步验证器,我想updateOn: 'blur'
使用以下方法设置属性FormBuilder
:
myForm = this.formBuilder.group({
email: ['', [Validators.required], [this.myAsyncValidator]]
// ...
});
我试过这个但它不起作用:
email: ['', [Validators.required], [this.myAsyncValidator, {updateOn: 'blur'}]]
笔记
我不想手动创建表单控件实例,如下所示:
myForm = new FormGroup({
email: new FormControl('', {asyncValidators: [this.myAsyncValidator]}, updateOn: 'blur')
});