cic-staff-client/src/app/_helpers/custom-error-state-matcher.ts
Spencer Ofwiti 8636cbdf99 Add helper classes.
- Add error state matcher for forms.
- Add custom validator for forms.
- Add error interceptor for incoming responses.
- Add unsafe key store for holding private keys.
2020-12-28 12:06:30 +03:00

10 lines
445 B
TypeScript

import {ErrorStateMatcher} from '@angular/material/core';
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';
export class CustomErrorStateMatcher implements ErrorStateMatcher{
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const isSubmitted = form && form.submitted;
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
}
}