Skip to content

Instantly share code, notes, and snippets.

@jhades
Last active May 21, 2016 20:42
Show Gist options
  • Save jhades/f62c8453aa44c38471db801a5e64bdc3 to your computer and use it in GitHub Desktop.
Save jhades/f62c8453aa44c38471db801a5e64bdc3 to your computer and use it in GitHub Desktop.
Introduction to AngularJs Form Validation
<form class="ng-pristine ng-invalid ng-invalid-required" name="frm">
<input name="password" ng-model="user.password" type="password" placeholder="Password"
required ng-minlength="6" ng-maxlength="10">
<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>
<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