Tutorialsplane

Angular disable button


Angular disable button On Click – Sometimes we need to disable buttons,links on click event. It is very simple to disable a button in AngularJs. You can use ng-disabled to disable the button, link in AngularJs. Here in this tutorial we are going to explain how you can use ng-disabled to enable and disable button in AngularJs. You can also use our online demo to edit and run the code online.


Angular disable button On Click

Here is a simple example to disable the button in AngularJs-

Angular disable button On Click Example:




 
 

  
<div ng-app="myApp">  
<div ng-controller="myController"> 

 <button ng-click="disableButton()" ng-disabled="disabledFlag">Disable Me</button>
</div> 
</div>
  
 

Try it »

The above example will disable the button if user clicks on the button. If you run the above example it will produce output something like this-