How to disable buttons using AngularJS ? Last Updated : 01 Aug, 2022 Suggest changes Share 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: Advertise with us Next Article How to disable buttons using AngularJS ? P PranchalKatiyar Follow 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 Article Tags : Web Technologies HTML AngularJS HTML-Misc AngularJS-Misc +1 More Like