aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/helpers/helpers.ts
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-09-24 12:59:08 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-09-24 12:59:08 +0200
commit5db0a156731dd36394f2fb22125b8cabcd95a783 (patch)
treead990a7321c09d0056c8d531e158a8becfb22e57 /src/app/helpers/helpers.ts
parente964f1c1be44ef74877531870c119aa110555ca1 (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.ts12
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);
}