bc0fea3310
Updates to angular 8 and updates all used components - removed wrapper class for ngx/pwa LocalStorrace - removed database lock service due to bugs - tried to work around a cycle of dependancies - changed some structure to be more close to default angular - removed legacy angular packages - removed date-picker since it was not currently used and is not compatible anymore - upgrade tinyMCE
23 lines
948 B
TypeScript
23 lines
948 B
TypeScript
import { ErrorStateMatcher } from '@angular/material/core';
|
|
import { FormControl, FormGroupDirective, NgForm } from '@angular/forms';
|
|
|
|
/**
|
|
* Custom state matcher for mat-errors. Enables the error for an input, if one has set the error
|
|
* with `setError` on the parent element.
|
|
*/
|
|
export class ParentErrorStateMatcher implements ErrorStateMatcher {
|
|
public isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
|
const isSubmitted = !!(form && form.submitted);
|
|
const controlTouched = !!(control && (control.dirty || control.touched));
|
|
const controlInvalid = !!(control && control.invalid);
|
|
const parentInvalid = !!(
|
|
control &&
|
|
control.parent &&
|
|
control.parent.invalid &&
|
|
(control.parent.dirty || control.parent.touched)
|
|
);
|
|
|
|
return (isSubmitted || controlTouched) && (controlInvalid || parentInvalid);
|
|
}
|
|
}
|