added custom ErrorStateMatcher to show feedback von Password Confirmation
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
import { PasswordErrorStateMatcher } from './password-error-state-matcher';
|
||||||
|
|
||||||
|
describe('PasswordErrorStateMatcher', () => {
|
||||||
|
it('should create an instance', () => {
|
||||||
|
expect(new PasswordErrorStateMatcher()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
11
src/app/account/register/password-error-state-matcher.ts
Normal file
11
src/app/account/register/password-error-state-matcher.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user