question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabled - is not included in formGroupValues

See original GitHub issue

I 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:open
  • Created 4 years ago
  • Reactions:2
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
maxime1992commented, Sep 24, 2019

I ran into cases where I wish it was coming from getRawValue but value does reflect what formGroupe.value would return except that it’s recursive. Maybe we could add a formGroupRawValues 🤔

Any thoughts?

2reactions
zakhenrycommented, Jan 10, 2020

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found