import { Injectable } from '@angular/core' ; import { AbstractControl } from '@angular/forms' ; @ Injectable ( { providedIn : 'root' , } ) export class CustomValidatorsService { constructor ( ) { } confirmPassword ( AC ) { const password = AC . get ( 'password' ) . value ; const confirmPassword = AC . get ( 'confirmPassword' ) . value ; const incorrect = password !== confirmPassword ; return incorrect ? { confirmPassword : true } : null ; } }