How to disable a form control in Angular ? Last Updated : 24 May, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we are going to see how to disable a form control in Angular 10. We will use AbstractControl disabled property to disable a form control element. Syntax: <formelement disabled></formelement> Return Value: boolean: returns boolean stating whether the element is disabled or not. Approach: Create the Angular app to be usedIn app.component.html make a form using ngForm directive.Now disable the form control element using AbstractControl disabled propertyServe the angular app using ng serve to see the output. Example 1: In this example, we have disabled the input element using this property. app.module.ts import { NgModule } from '@angular/core'; // Importing forms module import { FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppComponent } from './app.component'; @NgModule({ bootstrap: [ AppComponent ], declarations: [ AppComponent ], imports: [ FormsModule, BrowserModule, BrowserAnimationsModule, ] }) export class AppModule { } app.component.html <br> <form #gfg = "ngForm"> Name: <input type="text" name = 'name' ngModel disabled> </form> Output: Example 2: In this example, we have disabled the checkbox element using this property. app.module.ts import { NgModule } from '@angular/core'; // Importing forms module import { FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppComponent } from './app.component'; @NgModule({ bootstrap: [ AppComponent ], declarations: [ AppComponent ], imports: [ FormsModule, BrowserModule, BrowserAnimationsModule, ] }) export class AppModule { } app.component.html <br> <form #gfg = "ngForm"> Checked: <input type="checkbox" name = 'Check' ngModel disabled> </form> Output: Example 3: In this example, we have disabled the button element using this property. app.module.ts import { NgModule } from '@angular/core'; // Importing forms module import { FormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppComponent } from './app.component'; @NgModule({ bootstrap: [ AppComponent ], declarations: [ AppComponent ], imports: [ FormsModule, BrowserModule, BrowserAnimationsModule, ] }) export class AppModule { } app.component.html app.component.html <br> <form #gfg = "ngForm"> <button disabled>Disabled Button</button> </form> Output: Reference: https://angular.io/api/forms/AbstractControlDirective#disabled Comment More infoAdvertise with us Next Article How to disable a form control in Angular ? taran910 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Basics AngularJS-Questions Angular10 +1 More Similar Reads FormGroup and FormControl in Angular Handling forms is a common requirement in web applications, and Angular provides a robust solution through its Reactive Forms module. In this article, we will explore what FormGroup and FormControl are, how to use them, and best practices for building dynamic, reactive forms in Angular.Table of Cont 5 min read How to Conditionally Disable a Form Input in React-Bootstrap ? In this article, we will see how to conditionally disable a form input in React-Bootstrap. React-Bootstrap is a popular open-source library for building frontend components with the advantage of the pre-build component features of Bootstrap. Creating React Application And Installing ModuleStep 1: Cr 3 min read Angular PrimeNG Form Listbox Disabled Options Component Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will see how to use the Form Listbox Disabled Options Component in Angular Prime 3 min read Create A Template Driven Form In Angular Template Driven Form in Angular means managing form input and validation primarily through HTML templates, using Angular directives like ngModel for two-way data binding and ngForm for form management. This approach is ideal for simpler forms where most of the logic and validation are handled direct 4 min read How to disable buttons using AngularJS ? In this article, we will see how to disable the button using the particular directive in AngularJS. Sometimes, we need to disable the button, and link on the click event. This task can be accomplished by implementing the ng-disabled directive that is used to enable or disable HTML elements. Syntax: 2 min read Like