You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Updating disabled state after replacing FormGroup. #18381
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
When I try to replace FormGroup that is bound to template, disabled state of controls isn't updated.
I know, that I can use enable() and disable() methods, but in my case I'm generating complete FormGroups and I have to replace them.
For now I'm using workaround which crawls through whole AbstractControls tree and runs enable() and disable() methods but I believe it should be fixed in better way inside framework.
Expected behavior
Properly refreshed DOM when I toggle control's state using new instance of FormGroup.
Minimal reproduction of the problem with instructions
Click on 'Two enabled fields' button. Title select hasn't changed state to enabled.
Click on 'Two disabled fields' button. Name input hasn't changed state to disabled.
After each step value and state are updated inside connected FormControl (printed values) but change of disabled/enabled state is not propagated to DOM.
I created second plunker with one small change, I'm binding controls using [formControl] instead of formControlName and it behaves slightly different: it hasn't got any problems with switching state to disabled but it can't return to enabled state. Link: http://plnkr.co/edit/Xipc02DXwcv5y5gPmexo?p=preview
What is the motivation / use case for changing the behavior?
I need a clean way to replace FormGroups containing FormControls with disabled/enabled DOM state that corresponds to FormControl state.
Environment
Angular version: 4.3.0-beta.0
Browser:
- [x] Chrome (desktop) version 59.0.3071.115
- [x] Firefox version 54.0.1
- [x] IE version 11
For Tooling issues:
- Node version: v6.9.5
- Platform: Windows
Activity
TheRemjx01 commentedon Aug 3, 2017
I have also got troubled with this issue also. Is it fixed?
dzonatan commentedon Aug 16, 2017
Duplicate of #17806.
And fix is ready #18575
kara commentedon Dec 12, 2017
Yeah, looks like a duplicate of the bug tracked here #17806
angular-automatic-lock-bot commentedon Sep 13, 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.