Merge branch 'dmp-refactoring' of code-repo.d4science.org:MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Efstratios Giannopoulos 2024-06-18 12:23:11 +03:00
commit ecd69281e6
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { AfterContentChecked, Directive } from "@angular/core";
import { AfterContentChecked, Directive, Optional } from "@angular/core";
import { AbstractControl } from "@angular/forms";
import { MatFormField } from "@angular/material/form-field";
import { MatInput } from "@angular/material/input";
@ -15,9 +15,10 @@ import { MarkedValidatorFn } from "./validation/custom-validator";
})
export class ReactiveAsteriskDirective implements AfterContentChecked {
private readonly requiredValidatornames = ['RequiredWithVisibilityRulesValidator', 'required'];
constructor(private matFormField: MatFormField) { }
constructor(@Optional() private matFormField: MatFormField) { }
ngAfterContentChecked() {
if (!this.matFormField) return;
const ctrl = this.matFormField._control;
const abstractControl = ctrl?.ngControl?.control;
const validators = (abstractControl as AbstractControl & { _rawValidators: MarkedValidatorFn[] })?._rawValidators;