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.

getRawValue does not return the raw value of nested controls.

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

If I have a FormGroup a with a nested FormGroup b, a.getRawValue() only takes the .value of b, meaning that the values of disabled controls within b are not returned.

Expected behavior

I expect a.getRawValue() to return all values within the form.

Minimal reproduction of the problem with instructions

http://plnkr.co/edit/3VMar1qp8X6mHU6HJToA?p=preview values are missing from the output.

Updated version with both FormGroup and FormArray: http://plnkr.co/edit/m9OrFDi3c7qmMoWDtS1A?p=preview

What is the motivation / use case for changing the behavior? Current behaviour is unexpected.

  • Angular version: 2.1.0

The code looks the same in the latest version though.

  • Language: [TypeScript]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jsdevtomcommented, Sep 3, 2019

@mhevery Why was this closed? This still doesn’t work and has been marked as severity3: broken

0reactions
angular-automatic-lock-bot[bot]commented, Oct 4, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested Angular FormGroups getRawValue / patchValue from ...
I'm using this workaround instead of Angulars FormGroup getRawValue() , which works for nested groups: /** * @param control a FormControl or ...
Read more >
AbstractControl - Angular
The optional type parameter TRawValue represents the raw value type ( control.getRawValue() ). Constructorlink. Initialize the AbstractControl instance.
Read more >
Angular Reactive Forms: Tips and Tricks | by Netanel Basal
In order to get the complete form's values, we can use the FormGroup.getRawValue() method. Control Getters and Setters. I want to talk about...
Read more >
Angular FormArray - Complete Guide
getRawValue (): Gets the values of all form controls, via the control.value property of each control. Let's now learn how we can use...
Read more >
How to Use Angular FormArray(s) within FormGroup(s) In ...
Are you trying to use a FormArray on a dynamic/reactive Angular Form, but it is not working? This should help you solve your...
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