Skip to content

Instantly share code, notes, and snippets.

@nicobytes
Created September 23, 2019 14:54
Show Gist options
  • Save nicobytes/ac935c38f397670be4cb25613a0d9381 to your computer and use it in GitHub Desktop.
Save nicobytes/ac935c38f397670be4cb25613a0d9381 to your computer and use it in GitHub Desktop.
static passwordMatchValidator(control: AbstractControl) {
const password: string = control.get('password').value; // get password from our password form control
const confirmPassword: string = control.get('confirmPassword').value; // get password from our confirmPassword form control
// compare is the password math
if (password !== confirmPassword) {
// if they don't match, set an error in our confirmPassword form control
control.get('confirmPassword').setErrors({ NoPassswordMatch: true });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment