我有一个像这样的formGroup
this.profileForm = this._fb.group({
'first_name': ['', Validators.required],
'last_name': ['', Validators.required],
'phone': ['', Validators.compose([Validators.required, Validators.minLength(9)])],
'emailGroup' : this._fb.group({
'email': ['', Validators.required],
'confirm_email': ['', Validators.required],
},{ validator: EqualValidator }),
'passwordGroup' : this._fb.group({
'password': ['', Validators.required],
'confirm_password': ['', Validators.required],
},{ validator: EqualValidator })
})
一切正常,期待手机,似乎角度忽略了minLength验证器。只需输入一个字符,输入就有效。该代码有什么问题?