Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Disable md-button

I have a form(HTML) and a directive to do stuff when submit button is clicked.The form has 10 input fields. The requirement is to keep the submit button which is a disabled till the time user enters value in at least one field.

Can anyone please help me. Iam new to angular and could not find much help.

like image 738
Albert Pinto Avatar asked Dec 11 '22 21:12

Albert Pinto


1 Answers

simply use ng-disabled="true".

declare a function in your controller something like

checkInputFields which return either true or false depending on the form modal.

then use

<md-button ng-disabled="checInputFields()">
  Submit
</md-button>
like image 116
atinder Avatar answered Dec 30 '22 09:12

atinder