Skip to content

Commit

Permalink
Merge pull request #305 from JoschuaSchneider/fix/formcontrolnames-mi…
Browse files Browse the repository at this point in the history
…ssing-disabled-control-names

fix(helpers): get formGroupKeys from formControls
  • Loading branch information
maxime1992 committed Oct 25, 2023
2 parents 43dede0 + b579428 commit 0ba9ba3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion projects/ngx-sub-form/src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from './ngx-sub-form.types';
import {
ArrayPropertyKey,
Controls,
ControlsNames,
NewFormErrors,
OneOfControlsTypes,
Expand Down Expand Up @@ -122,7 +123,9 @@ export function createFormDataFromOptions<ControlInterface, FormInterface extend
options.formGroupOptions as AbstractControlOptions,
) as TypedFormGroup<FormInterface>;
const defaultValues: FormInterface = cloneDeep(formGroup.value);
const formGroupKeys: (keyof FormInterface)[] = Object.keys(defaultValues) as (keyof FormInterface)[];
const formGroupKeys: (keyof Controls<FormInterface>)[] = Object.keys(
options.formControls,
) as (keyof Controls<FormInterface>)[];
const formControlNames: ControlsNames<FormInterface> = formGroupKeys.reduce<ControlsNames<FormInterface>>(
(acc, curr) => {
acc[curr] = curr;
Expand Down

0 comments on commit 0ba9ba3

Please sign in to comment.