formGroup disable()/enable() does not work right after init
See original GitHub issueI’m submitting a…
[x] Bug report
Current behavior
I you create a formGroup
using formBuilder.group()
and call formGroup.disable()
or formGroup.enable()
right after initialization then it doesn’t work.
If you call it using button
or setTimeout()
then it works.
Expected behavior
Would be nice to be able to disable/enable form right after creation.
Minimal reproduction of the problem with instructions
View: https://ng-form-disable-after-init.stackblitz.io Edit: https://stackblitz.com/edit/ng-form-disable-after-init
Environment
Angular version: 5.2.7
Issue Analytics
- State:
- Created 6 years ago
- Reactions:66
- Comments:42 (2 by maintainers)
Top Results From Across the Web
Angular 4 - Reactive Forms enable/disable not working
You just need enable/disable methods of form control. Here is stackblitz example. It works perfectly. @Component({ selector: 'my-app', ...
Read more >How to disable/enable an Angular FormGroup after init - Medium
This content highlight a simple solution to enable/disable a FormGroup in Angular. By adding the bold line below between the creation and the...
Read more >Exploring the difference between disabling a form control ...
I'm using formGroup and formControlName directives from Reactive Forms API here. Using the FormControl's disable() instance method. Link to this section. This ...
Read more >Angular Reactive Forms: Tips and Tricks | by Netanel Basal
There might be cases when we don't want to invalidate the form just because a single control ... Whenever we call a control's...
Read more >AbstractControl - Angular
A control is enabled as long as its status is not DISABLED . ... call enable() or disable() without passing along {emitEvent: false}...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same issue on 8.2.14
Version 8 is about to drop…is this bug going to be addressed? I noticed that the severity of this bug is marked as ‘inconvenient’. I wouldn’t say that it’s inconvenient. It essentially breaks the first precept of reactive forms where they are supposed to be synchronous. Somehow a race condition is occurring in ‘synchronous’ code.