diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-09-24 12:59:08 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-09-24 12:59:08 +0200 |
commit | 5db0a156731dd36394f2fb22125b8cabcd95a783 (patch) | |
tree | ad990a7321c09d0056c8d531e158a8becfb22e57 /src/app/helpers/helpers.ts | |
parent | e964f1c1be44ef74877531870c119aa110555ca1 (diff) |
Upgrade to Angular 14
Issue-ID: PORTALNG-121
Change-Id: Ic0ee5450b1e234036dc567b14da15c8febb06e94
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'src/app/helpers/helpers.ts')
-rw-r--r-- | src/app/helpers/helpers.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/app/helpers/helpers.ts b/src/app/helpers/helpers.ts index 7c03dbd..6b0c486 100644 --- a/src/app/helpers/helpers.ts +++ b/src/app/helpers/helpers.ts @@ -17,7 +17,7 @@ */ -import { FormArray, FormGroup } from '@angular/forms'; +import { UntypedFormArray, UntypedFormGroup } from '@angular/forms'; export function isNotUndefined<T>(val: T | undefined): val is T { return val !== undefined; @@ -27,7 +27,7 @@ export function isNotNull<T>(val: T | null): val is T { return val !== null; } -export function markAsDirtyAndValidate(formGroup: FormGroup): void { +export function markAsDirtyAndValidate(formGroup: UntypedFormGroup): void { Object.values(formGroup.controls).forEach(control => { control.markAsDirty(); control.updateValueAndValidity(); @@ -54,10 +54,10 @@ export function getRandomNumber(min: number, max: number) { return Math.floor(Math.random() * (max - min + 1)) + min; } -export function areFormControlsValid(form: FormGroup): boolean { +export function areFormControlsValid(form: UntypedFormGroup): boolean { const formControls = Object.keys(form.controls) .map(key => form.controls[key]) - .filter(control => !(control instanceof FormArray)); + .filter(control => !(control instanceof UntypedFormArray)); return formControls.find(control => control.invalid && (control.dirty || control.touched)) === undefined; } @@ -68,9 +68,9 @@ export function isString(value: any): boolean { export function resetSelectDefaultValue(cssSelector: string): void { setTimeout(() => { const element = document.querySelector(cssSelector); - if (element) { + if (element && document.querySelector(cssSelector)) { //@ts-ignore - document.querySelector(cssSelector)?.selectedIndex = -1; + document.querySelector(cssSelector).selectedIndex = -1; } }, 0); } |