12 lines
547 B
TypeScript
12 lines
547 B
TypeScript
import { ErrorStateMatcher } from '@angular/material/core';
|
|
import { FormControl, FormGroupDirective, NgForm } from '@angular/forms';
|
|
|
|
export class PasswordErrorStateMatcher implements ErrorStateMatcher {
|
|
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
|
const invalidControl = !!(control && control.invalid && control.parent.touched);
|
|
const invalidParent = !!(control && control.parent && control.parent.invalid && control.parent.touched);
|
|
|
|
return invalidControl || invalidParent;
|
|
}
|
|
}
|