Improve this Doc View Source ngMessage

From Get docs
< Improve this Doc ngMessages‎ | directiveAngularjs/docs/1.8/api/ngmessages/directive/ngmessage

Improve this Doc View Source ngMessage

  1. directive in module ngMessages


ngMessage is a directive with the purpose to show and hide a particular message. For ngMessage to operate, a parent ngMessages directive on a parent DOM element must be situated since it determines which messages are visible based on the state of the provided key/value map that ngMessages listens on.

More information about using ngMessage can be found in the ngMessages module documentation.

Directive Info

  • This directive creates new scope.
  • This directive executes at priority level 1.


<!-- using attribute directives -->
<ANY ng-messages="expression" role="alert">
  <ANY ng-message="stringValue">...</ANY>
  <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>

<!-- or by using element directives -->
<ng-messages for="expression" role="alert">
  <ng-message when="stringValue">...</ng-message>
  <ng-message when="stringValue1, stringValue2, ...">...</ng-message>


Param Type Details
when expression a string value corresponding to the message key.

© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.