我正在尝试将值发送到自定义表单验证器:
varbinary
但它不喜欢我发送this.myForm = this.fb.group({
Id: [null],
Password: ['', [Validators.required]],
PasswordConfirm: ['', Validators.compose([CustomValidators.expectedMatchingFields(this.myForm.controls.Password.value), Validators.required])]
});
。还有另一种方式吗?
错误地说"this.myForm.controls.Password.value"
。
答案 0 :(得分:1)
this.myForm为null
LinkedList
在调用this.fb.group()之前,您无法执行此操作。 我的建议:创建没有此验证器的表单,然后更新它,如here所述。
我想这可能有用
CustomValidators.expectedMatchingFields(this.myForm.controls.Password.value)
});
this.myForm = this.fb.group({
Id: [null],
Password: ['', [Validators.required]],
PasswordConfirm: ['']