How to disable/enable an Angular FormGroup after init

Nasreddine Skandrani
Front-End Tricks — TheBlog
1 min readMay 31, 2020

This content highlight a simple solution to enable/disable a FormGroup in Angular.

By adding the bold line below between the creation and the disable call for your form, you’ll achieve the desired result.

this.form = this.fb.group({
'fieldA' : 'test'
});
this.cdr.detectChanges();
this.form.disable(); // or enable

You can find an online example here.

You can also subscribe to the official github issue here to check a more detailed answer from me and also what angular core team will do with this.

You found this post helpful! give it some 👏👏👏.
Thank you

@FrontEndTricks

--

--