Created
December 2, 2015 03:58
-
-
Save lamarmarshall/edecb5043d75420c9009 to your computer and use it in GitHub Desktop.
angular custom validation
This file contains 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
<p> | |
<label for="full_name">Full Name</label> | |
<!-- each form must have name and html validation --> | |
<!-- must have ng-class variable object with classes like this --> | |
<input type="text" ng-model="formModel.fullname" name="full_name" required="required" | |
ng-pattern="^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$" | |
ng-class="{ | |
green: theForm.full_name.$valid , | |
red: !theForm.full_name.$valid && !theForm.$pristine | |
}" | |
> | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment