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
A new FormControl instance can disable an input, but it can't enable it #35565
As form controls can disable inputs, it seems like a bug that they can't enable them. Or is it a feature request? It works if you only work with a single FormControl instance. But if you give an disabled input a new FormControl instance, you are stuck.
Click on create enabled FormControl and the input stays enabled. Click at least once on create disabled FormControl, and the enabled control won't kick the input out of the disabled state. And it doesn't inherit the disabled state from the input either.
changed the title [-]FormControl can disable an input, but it can't enable it[/-][+]A new FormControl instance can disable an input, but it can't enable it[/+]on Feb 19, 2020
This seems like a huge deal, since reactive forms seem to be preached as the best approach everywhere. Yet I can not disable an input... Any other workarounds?
If i understand the problem, the best approach would be not to create a new instance from an already instanciated FormControl. You should use setValue or patchValue if you need to change the value of the FormControl.
Activity
[-]FormControl can disable an input, but it can't enable it[/-][+]A new FormControl instance can disable an input, but it can't enable it[/+]navarrofracisco commentedon Mar 4, 2020
Any update on this? and is it related to? #22556.
This seems like a huge deal, since reactive forms seem to be preached as the best approach everywhere. Yet I can not disable an input... Any other workarounds?
geromegrignon commentedon Mar 4, 2020
If i understand the problem, the best approach would be not to create a new instance from an already instanciated FormControl. You should use setValue or patchValue if you need to change the value of the FormControl.
sonukapoor commentedon Mar 22, 2020
@petebacondarwin I can take a look at this one. Can you assign it to me please?
mart2k commentedon Jul 2, 2020
Workaround until fixed:
<input [formControl]="control" [attr.disabled]="control.disabled? '' : null">angular-automatic-lock-bot commentedon Feb 9, 2021
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.