Last active
May 21, 2016 20:42
-
-
Save jhades/f62c8453aa44c38471db801a5e64bdc3 to your computer and use it in GitHub Desktop.
Introduction to AngularJs 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 class="ng-pristine ng-invalid ng-invalid-required" name="frm"> | |
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
<input name="password" ng-model="user.password" type="password" placeholder="Password" | |
required ng-minlength="6" ng-maxlength="10"> | |
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
<div class="pure-control-group"> | |
<label>Password</label> | |
<input name="password" ng-model="user.password" | |
type="password" placeholder="Password" | |
required ng-minlength="6" ng-maxlength="10"> | |
<div class="field-message" | |
ng-messages="frm.password.$error" | |
ng-if='frm.password.$dirty' ng-cloak> | |
<div ng-message="required">Password is required</div> | |
<div ng-message="minlength"> | |
Password must have minimum 6 characters | |
</div> | |
<div ng-message="maxlength"> | |
Password must have maximum 10 characters | |
</div> | |
</div> | |
</div> | |
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
<button type="submit" class="pure-button pure-button-primary" | |
ng-disabled="frm.$invalid || !conditions">Submit</button> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment