i am developing a application in angular 4. there i have a small form. validations are working fine. but i want to verify that both passwords and the password confirm fields are same.
registerUser = this.fb.group({
name: new FormControl(this.data.name, Validators.required),
email: new FormControl({value: this.data.email, disabled: true}, [
Validators.required,
Validators.email,
this.valdaitionService.emailDomainValidator
]),
emailp: new FormControl(this.data.emailp,Validators.email),
designation:new FormControl({value: this.data.designation, disabled: true}, Validators.required),
empType:new FormControl({value: this.data.empType, disabled: true}, Validators.required),
mobileNo:new FormControl(this.data.mobileNo, [Validators.required]),
year:new FormControl({value: this.data.year, disabled: true}, [Validators.required]),
month:new FormControl({value: this.data.month, disabled: true}, [Validators.required]),
password: new FormControl("", []),
passwordc: new FormControl("", []),
});
is there a way in angular for form control that i can verify both password and passwordc fields are equal.
You should implement your custom validator directive. I assume you did similar job on "this.valdaitionService.emailDomainValidator).
For your reference please check the link below: