Skip to content

Instantly share code, notes, and snippets.

@matsko
Last active December 28, 2015 19:59
Show Gist options
  • Save matsko/7553862 to your computer and use it in GitHub Desktop.
Save matsko/7553862 to your computer and use it in GitHub Desktop.
<script type="text/ng-template" id="form-template">
<div ng-messages>
<div ng-message="invalid">You entered an invalid value for this field</div>
<div ng-message="required">This value is required</div>
<div ng-message="minlength">Your value is too short</div>
</div>
</script>
<form>
<input name="myEmailInput" />
<div ng-messages-for="myForm.myInput" template="form-template">
<!-- this replaces the "invalid" message <div> inside of the template above -->
<div ng-message="invalid">You entered your email incorrectly</div>
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment