【发布时间】:2018-12-13 00:02:51
【问题描述】:
我想检查两个字段的值是否相同,这些字段必须通过参数传递给验证函数,我正在这样做,问题是它无法获取字段的值,它显示为 null,因为我可以正确动态地获取值吗?
我的表单生成器,我正在使用匹配功能来检查手机和确认字段。
this.recharge = this.formBuilder.group({
cell_phone: ['', Validators.required, Validations.match('cell_phone', 'cell_phone_confirmation')],
cell_phone_confirmation: ['', [Validators.required]],
value: ['', Validators.required],
operator_id: ['', Validators.required]
});
在我的函数中,控制台日志为空:
static match(field1: string, field2: string){
return (group: FormGroup) => {
console.log(group.get(field1));
}
}
【问题讨论】:
标签: angular ionic-framework ionic3