Disabled - is not included in formGroupValues
See original GitHub issueI noticed this.formGroup.value
is being used in ngx-sub-form.component.ts
rather than this.formGroup.getRawValue()
.
this.formGroup.value
will omit any disabled controls.
Demo - https://stackblitz.com/edit/ngx-sub-form-stepper-form-demo-s5ajvo * Note how with
secondUnique: new FormControl({value:'1', disabled: true}),
that this is missing from the values.
*_copy of original https://stackblitz.com/edit/ngx-sub-form-stepper-form-demo_
I would be interested if this is intended behaviour? Note this hasn’t come from my own use cases.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:18 (4 by maintainers)
Top Results From Across the Web
Angular 2 disabled controls do not get included in the form. ...
I have noticed that if I disable a control on an Angular 2 reactive form then the control does not get included in...
Read more >Exploring the difference between disabling a form control ...
We've given the form controls default values, disabled both the controls and required the firstName control by having a required validator on its...
Read more >Disabled formGroup's value returns all the values of its ...
1 - When a form group or form array is enabled, it omits any disabled children from its serialized value to mimic native...
Read more >Disabling Form Controls When Working With Reactive ...
Instantiate a new FormControl with the disabled property set to true. FormControl({value: '', disabled: true}) . Calling control.disable() or control.enable() .
Read more >Angular — Disable a Form while Preserving Form Control ...
When we either enable or disable our form (group), ... kind of expects you to not use the enable and disable functions provided...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I ran into cases where I wish it was coming from
getRawValue
butvalue
does reflect whatformGroupe.value
would return except that it’s recursive. Maybe we could add aformGroupRawValues
🤔Any thoughts?
Yea, I think having a
formGroupRawValues
is the best outcome here, as it would be a breaking change otherwise and not really expected (we should be mirroring angular’s behavior where it isn’t broken)