angularjsangularjs-directiveangular-materialui-validate

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.


Solution

  • 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>