/Angular.js 1.8

Directive components in ngMessages

Name Description

ngMessages is a directive that is designed to show and hide messages based on the state of a key/value object that it listens on. The directive itself complements error message reporting with the ngModel $error object (which stores a key/value state of validation errors).


ngMessagesInclude is a directive with the purpose to import existing ngMessage template code from a remote template and place the downloaded template code into the exact spot that the ngMessagesInclude directive is placed within the ngMessages container. This allows for a series of pre-defined messages to be reused and also allows for the developer to determine what messages are overridden due to the placement of the ngMessagesInclude directive.


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.


ngMessageExp is the same as ngMessage, but instead of a static value, it accepts an expression to be evaluated for the message key.


ngMessageDefault is a directive with the purpose to show and hide a default message for ngMessages, when none of provided messages matches.

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