Created
May 31, 2015 18:08
-
-
Save Rokt33r/e1dc98c61bb88ddf5c11 to your computer and use it in GitHub Desktop.
Angular Form Validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="addForm" name="addForm" novalidate> | |
<label>Category:</label> | |
<select ng-model="expense.category" ng-options="category for category in categories"></select> | |
<label>Amount:</label> | |
<input required type="number" ng-model="expense.amount"></input> | |
<label>Description:</label> | |
<input type="text" ng-pattern="/^[a-zA-Z 0-9]*$/" ng-model="expense.description"></input> | |
<button ng-disabled="addForm.$pristine || addForm.$dirty && addForm.$invalid" ng-click="submit()">Submit</button> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment