RED-10139: moved formToSignal functions to common.
Future refactoring purposes.
This commit is contained in:
parent
ba85260cc4
commit
3f214d9726
@ -1,9 +1,10 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { UntypedFormGroup } from '@angular/forms';
|
||||
import { AbstractControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import dayjs, { type Dayjs } from 'dayjs';
|
||||
import { forOwn, has, isEqual, isPlainObject, transform } from 'lodash-es';
|
||||
import { Id, ITrackable } from '../listing/models/trackable';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
|
||||
export function capitalize(value: string | string): string {
|
||||
if (!value) {
|
||||
@ -330,3 +331,11 @@ export function getParamFromDialog(param: string, activatedRoute = inject(Activa
|
||||
|
||||
return getParam(param, getLastChild(activatedRoute.root));
|
||||
}
|
||||
|
||||
export function formValueToSignal<T>(control: AbstractControl<T>) {
|
||||
return toSignal(control.valueChanges, { initialValue: control.value });
|
||||
}
|
||||
|
||||
export function formStatusToSignal<T>(control: AbstractControl<T>) {
|
||||
return toSignal(control.statusChanges, { initialValue: control.status });
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user