Disable submit button when form invalid with AngularJS
angularjs, button, disabled-control, forms
Solution
You need to use the name of your form, as well as ng-disabled: Here's a demo on Plunker
<form name="myForm">
<input name="myText" type="text" ng-model="mytext" required />
<button ng-disabled="myForm.$invalid">Save</button>
</form>
Problem
I have my form like this: ``` <form name="myForm"> <input name="myText" type="text" ng-model="mytext" required /> <button disabled="{{ myForm.$invalid }}">Save</button> </form> ``` As you may see, the button is disabled if the input is empty but it doesn't change back to enabled when it contains text. How can I make it work?