Disabling Your Angular Reactive Form

Ole Ersoy
Ole Ersoy
Nov 6 · 1 min read
Image by Gerd Altmann from Pixabay

Scenario

We have a reactive Angular form and we want to disable it programmatically.

Approach

this.form.disable();

Demo

We disable the login form in the ngOnInit block. It’s not possible to enter anything in the form fields and the styling has change to indicate that the form is disabled ( Note that the submit button is not disabled ) :

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade