Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
Created December 2, 2015 03:36
Show Gist options
  • Save lamarmarshall/af41f7396c6655753b59 to your computer and use it in GitHub Desktop.
Save lamarmarshall/af41f7396c6655753b59 to your computer and use it in GitHub Desktop.
angular form error messages
<p>
<label for="email">Email</label>
<input type="email" ng-model="formModel.email" name="email" required="required"
ng-class="{green: theForm.email.$valid ,
red: !theForm.email.$valid && !theForm.$pristine
}">
<p class="red" ng-show="theForm.email.$error.required && !theForm.$pristine">
email is required
</p>
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment