How to disable buttons using AngularJS ? Last Updated : 01 Aug, 2022 Comments Improve Suggest changes Like Article Like Report 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: <element ng-disabled="expression"> Contents... </element>Parameter value: expression: It represents an expression that returns true if it sets the disabled attribute for the element.This directive can be utilized to set the form field such as input, select, or textarea, with having the disabled attribute, i.e. it is supported by <input>, <select>, and <textarea> elements. Example 1: This example illustrates the ng-disabled directive by disabling the button. HTML <!DOCTYPE HTML> <html> <head> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"> </script> <script> var myApp = angular.module("app", []); myApp.controller("controller", function($scope) { $scope.disabledFlag = false; $scope.disableIt = function() { $scope.disabledFlag = true; }; }); </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h3> Disable the button in AngularJS </h3> <div ng-app="app"> <div ng-controller="controller"> <button ng-click='disableIt()' ng-disabled='disabledFlag'> Click to disable </button> </div> </div> </body> </html> Output: Example 2: This example illustrates the implementation of the ng-disabled directive to disable multiple buttons. HTML <!DOCTYPE HTML> <html> <head> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"> </script> <script> var myApp = angular.module("app", []); myApp.controller("controller", function($scope) { $scope.disabledFlag1 = false; $scope.disableIt1 = function() { $scope.disabledFlag1 = true; }; $scope.disabledFlag2 = false; $scope.disableIt2 = function() { $scope.disabledFlag2 = true; }; $scope.disabledFlag3 = false; $scope.disableIt3 = function() { $scope.disabledFlag3 = true; }; $scope.disabledFlag = false; $scope.disableIt = function() { $scope.disabledFlag1 = true; $scope.disabledFlag2 = true; $scope.disabledFlag3 = true; }; }); </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h3> Disable the button in AngularJS </h3> <div ng-app="app"> <div ng-controller="controller"> <button ng-click='disableIt1()' ng-disabled='disabledFlag1'> disable it </button> <button ng-click='disableIt2()' ng-disabled='disabledFlag2'> disable it </button> <button ng-click='disableIt3()' ng-disabled='disabledFlag3'> disable it </button> <br> <br> <button ng-click='disableIt()' ng-disabled='disabledFlag'> disable All </button> </div> </div> </body> </html> Output: Comment More infoAdvertise with us Next Article How to disable buttons using AngularJS ? P PranchalKatiyar Follow Improve Article Tags : Web Technologies HTML AngularJS HTML-Misc AngularJS-Misc +1 More Similar Reads Angular PrimeNG Focus Trap Disabled Button 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. This article will show us how to use the Focus Trap Disabled Button in Angular PrimeNG. We will also 3 min read How to enable/disable a button using jQuery ? Enabling/disabling a button using jQuery involves altering its functionality to either accept user input or not. This is typically done by manipulating its 'disabled' property or attribute through jQuery methods like `.prop()` or .attr().To enable/disable a button using jQuery, you'll need a basic H 2 min read How to Disable a Button in jQuery UI ? To disable a button in jQuery UI, we will be using disable() method which is discussed below: jQuery UI disable() method is used to completely disable the button. It returns the button element completely to its initial state. Syntax: $(".selector").button("disable") Parameters: This method does not 2 min read How to make a Disable Buttons using jQuery Mobile ? jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be making a Disable Button using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel="stylesheet 1 min read How to make buttons using Angular UI Bootstrap ? In this article, we will see how to make buttons using Angular UI bootstrap. Angular UI Bootstrap is an Angular JS framework created by Angular UI developers for providing better UI which can be used easily. Buttons directive is used for making buttons. Syntax: <buttonclass='btn btn-primary'>b 2 min read How to disable radio button using JavaScript ? Radio buttons let users select one option from many, commonly used in forms. Sometimes, based on a user's previous choice, certain options need to be disabled. For example, if a user selects "No" to playing games, we can disable related game options. Using JavaScript, about 65% of forms use such log 4 min read Angular Material Button Toggle Angular Material is a UI component library that is developed by Google so that Angular developers can develop modern applications in a structured and responsive way. By making use of this library, we can greatly increase the user experience of an end-user thereby gaining popularity for our applicati 4 min read AngularJS ng-disabled Directive In this article, we will see the AngularJS ng-disabled Directive, along with understanding its implementation through the illustrations. The ng-disabled Directive in AngularJS is used to enable or disable the HTML elements. If the expression inside the ng-disabled attribute returns true then the for 2 min read How to disable a form control in Angular ? 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 o 2 min read How to Disable a Button in React JS ? Disabling a button in React JS means making it unclickable and visually indicating its unavailability. This is done by setting the button's disabled attribute to true. It's used for controlled interactions, like form submissions with valid data.A disabled button becomes unclickable and visually sign 4 min read Like