Changing from disabled to enabled formControl instance does not enable the underlying input in the DOM

This issue has been created since 2022-09-16.

Which @angular/* package(s) are the source of the bug?

forms

Is this a regression?

No

Description

If I replace a disabled form control on an input with an enabled form control, the disabled state is not reflected on the input element in the DOM.

That is if I have an input like this

<input [formControl]="control">

and in the controller some logic like this

doWork(disabled) {
    this.control = new FormControl({
        value: 'foo',
        disabled: disabled
    });
}

and call doWork once with false, the input will stay disabled even when I replace the control with an enabled. You can check out the stackblitz link to try a live demo with a potential workaround.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-oanfqv

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 14.2.3
Node: 18.7.0 (Unsupported)
Package Manager: npm 8.15.0
OS: win32 x64

Angular: 14.2.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.3
@angular-devkit/build-angular   14.2.3
@angular-devkit/core            14.2.3
@angular-devkit/schematics      14.2.3
@angular/cli                    14.2.3
@schematics/angular             14.2.3
rxjs                            7.5.6
typescript                      4.7.4

Anything else?

I can work around this issue by calling formControl.enable() to force angular to re-enable the DOM in a setTimeout or after the microtask queue is cleared in the zone

AndrewKushnir wrote this answer on 2022-09-16

@Andreas-Hjortland it looks like this is a duplicate of #35309. I'm closing this ticket, please subscribe to #35309 to receive further updates. Thank you.

More Details About Repo
Owner Name angular
Repo Name angular
Full Name angular/angular
Language TypeScript
Created Date 2014-09-18
Updated Date 2022-10-04
Star Count 84139
Watcher Count 3064
Fork Count 22243
Issue Count 1206

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Notify users when a new Control Tower landing zone update is available 1 2021-08-10 2022-09-10
Option to configure `<details>` for commit lists 0 2022-05-01 2022-07-19
On notification page, is it unknown the author 0 2022-04-05 2022-10-04
Apparently i can flag myself and my own activities 0 2022-04-05 2022-10-04
Magic auth API key expired 3 2022-03-03 2022-10-02
suggestListSuspending() with player list causes critical error 2 2022-02-08 2022-10-02
Dict Comprehension speeds up data preparation 3 2021-10-04 2022-08-01
Clipperz.PM.DataModel.User.exception.LoginFailed 60 2015-05-27 2022-07-30
Use snap driver when chromium is installed via snap package 15 2021-09-27 2022-10-01
[Feature request] Mutate some precompilation variables into dynamic parameters (for BT) 0 2022-07-15 2022-10-04
inconsistent results of manual calculate with the Findmarkers function 2 2022-06-30 2022-08-31
应用被Google Play下架? 4 2021-12-28 2022-01-14
希望可以增加车载歌词显示功能 0 2021-11-13 2022-01-14
能否添加对远程文件夹(webdav,samba)的支持 1 2021-10-31 2022-09-15
Setting `nord_disable_background` has no effect 5 2021-07-09 2022-09-26
Improve the specification document to give more details on how multiple actions are handled 2 2021-10-01 2022-10-01
deleteDocuments results in: Validation Failed 3 2021-12-17 2022-09-14
Bump src/deps/pybind11 from `9978ed5` to `ad96655` 1 2021-10-04 2022-01-29
jupyter notebook example bloch-sphere-animation - matplotlib.animation:MovieWriter avconv unavailable 5 2018-07-15 2022-09-22
Add configurable sensitivity to the mouse wheel 2 2022-02-11 2022-09-30
Re-applying of traits in the class hierarchy should not be allowed 0 2022-01-21 2022-07-25
Some in-measure clefs still missing 0 2022-01-14 2022-09-21
[Linux] `cpu_percent` does not work within `oneshot` context manager as expected 1 2022-02-16 2022-09-26
SC1088 Parsing stopped here. Invalid use of parentheses? on a valid Windows Dockerfile 0 2021-05-18 2022-07-09
Addition of VarStore merging capabilities 2 2022-06-07 2022-09-23
Trying to close channels and withdraw funds back to layer 1 from my LND wallet/node 2 2022-02-25 2022-09-03
Yielding multiple items 0 2022-08-25 2022-09-06
Document how settings must be picklable 0 2022-08-24 2022-09-18
Checkout flow error on click of checkout button 1 2020-12-18 2022-09-17
Cookies in request header get deleted by matomo 7 2021-03-18 2022-10-02
bug: windows-based log agent isn't forwarding logs 0 2021-11-13 2022-09-26
Ubuntu 21.04 both powershell and powershell-preview fail to start 1 2021-06-21 2022-10-01
IRC->Matrix bridging of #matrix-spec on Libera is broken 4 2022-06-06 2022-09-27
[QUESTION]如何启动是执行特定Task 7 2021-12-08 2022-09-18
When mail reply from collaborator side in agent and customer reply email template so collaborator email reply creates a new ticket 0 2022-09-22 2022-09-19
Two settings that sounds the same: "Enable chatting online" and "Enable chatting in online games" 4 2021-09-23 2022-07-29
typo in link to layout patterns landing page 0 2022-08-02 2022-08-09
Separate Burning crusade Classic and Classic era addons 2 2021-05-20 2022-07-23
pTooltip [escape]=false is not rendering the html contents since [email protected] 5 2022-03-29 2022-04-14
Account recovery request 2 2021-09-16 2022-10-01
Optional default for message fields 7 2021-08-18 2022-09-24
Error corrupt blocks "Invalid magic number: 0" 4 2022-05-11 2022-10-01
Sample documentation for IoT Jobs 4 2021-11-24 2022-10-02
Mapper Struggling During CM 2 2022-01-25 2022-08-22
UnicodeEncodeError: 'charmap' codec can't encode character '\u03a9' in position 0: character maps to <undefined> 3 2021-10-20 2022-09-22
[email protected] 1 2022-04-19 2022-04-12
Multiple Files - crashed by Sig 11 12 2021-09-03 2022-09-20
[Heartbeat] Stop appending ` - inline` to monitors 7 2021-12-17 2022-07-28
[Rule Tuning] CWP Rule Review and Tuning (Okta) 1 2022-08-03 2022-10-03
Favicon not copied if located in upper folder 2 2021-08-27 2022-09-30