Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled FormControl is omitted from formControlNames #303

Closed
JoschuaSchneider opened this issue Oct 16, 2023 · 2 comments · Fixed by #305
Closed

Disabled FormControl is omitted from formControlNames #303

JoschuaSchneider opened this issue Oct 16, 2023 · 2 comments · Fixed by #305
Labels

Comments

@JoschuaSchneider
Copy link
Contributor

When defining FormControls as disabled: true they are omitted from form.formControlNames, which causes the following error when using the form.formControlNames.myDisabledControl key in the template:

image

We are currently migrating from the Inheritance based API to the new API and just ran into this issue.

I looked at the implementation of the formControlNames and noticed that they are created from the keys of the form.value from which values of disabled controls are omitted.

In the deprecated API those names where generated using the mapControl function instead.

I would expect the control name to exist even for disabled controls, as the TypeScript interface also suggests.

If this is not intended I can open a PR for this :)

@maxime1992
Copy link
Contributor

It's not intended, if you can raise a PR that'd be great thanks!

JoschuaSchneider added a commit to JoschuaSchneider/ngx-sub-form that referenced this issue Oct 24, 2023
Form control names are now generated from the formControls instead of
the formGroup value in which disabled controls are not present.

Fixes cloudnc#303
maxime1992 pushed a commit to JoschuaSchneider/ngx-sub-form that referenced this issue Oct 25, 2023
…formGroup.value to correctly include disabled controls

Fixes cloudnc#303
@github-actions
Copy link

🎉 This issue has been resolved in version 9.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants