EVOLUTION-MANAGER
Edit File: ngMessages.html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/ngMessages/messages.js?message=docs(ngMessages)%3A%20describe%20your%20change...#L159' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a> <a href='https://github.com/angular/angular.js/tree/v1.3.9/src/ngMessages/messages.js#L159' class='view-source pull-right btn btn-primary'> <i class="glyphicon glyphicon-zoom-in"> </i>View Source </a> <header class="api-profile-header"> <h1 class="api-profile-header-heading">ngMessages</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - directive in module <a href="api/ngMessages">ngMessages</a> </li> </ol> </header> <div class="api-profile-description"> <p><code>ngMessages</code> 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 compliments error message reporting with the <code>ngModel</code> $error object (which stores a key/value state of validation errors).</p> <p><code>ngMessages</code> manages the state of internal messages within its container element. The internal messages use the <code>ngMessage</code> directive and will be inserted/removed from the page depending on if they're present within the key/value object. By default, only one message will be displayed at a time and this depends on the prioritization of the messages within the template. (This can be changed by using the ng-messages-multiple on the directive container.)</p> <p>A remote template can also be used to promote message reuseability and messages can also be overridden.</p> <p><a href="api/ngMessages">Click here</a> to learn more about <code>ngMessages</code> and <code>ngMessage</code>.</p> </div> <div> <h2>Directive Info</h2> <ul> <li>This directive executes at priority level 0.</li> </ul> <h2 id="usage">Usage</h2> <div class="usage"> <pre><code class="lang-html"><!-- using attribute directives --> <ANY ng-messages="expression"> <ANY ng-message="keyValue1">...</ANY> <ANY ng-message="keyValue2">...</ANY> <ANY ng-message="keyValue3">...</ANY> </ANY> <!-- or by using element directives --> <ng-messages for="expression"> <ng-message when="keyValue1">...</ng-message> <ng-message when="keyValue2">...</ng-message> <ng-message when="keyValue3">...</ng-message> </ng-messages> </code></pre> </div> <section class="api-section"> <h3>Arguments</h3> <table class="variables-matrix input-arguments"> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td> ngMessages </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>an angular expression evaluating to a key/value object (this is typically the $error object on an ngModel instance).</p> </td> </tr> <tr> <td> ngMessagesMultiple | multiple <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>when set, all messages will be displayed with true</p> </td> </tr> <tr> <td> ngMessagesInclude | include <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>when set, the specified template will be included into the ng-messages container</p> </td> </tr> </tbody> </table> </section> <h2 id="example">Example</h2><p> <div> <a ng-click="openPlunkr('examples/example-ngMessages-directive')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-ngMessages-directive" name="ngMessages-directive" module="ngMessagesExample" deps="angular-messages.js" animations="true" fixBase="true"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><form name="myForm"> <label>Enter your name:</label> <input type="text" name="myName" ng-model="name" ng-minlength="5" ng-maxlength="20" required /> <pre>myForm.myName.$error = {{ myForm.myName.$error | json }}</pre> <div ng-messages="myForm.myName.$error" style="color:maroon"> <div ng-message="required">You did not enter a field</div> <div ng-message="minlength">Your field is too short</div> <div ng-message="maxlength">Your field is too long</div> </div> </form></code></pre> </div> <div class="runnable-example-file" name="script.js" language="js" type="js"> <pre><code>angular.module('ngMessagesExample', ['ngMessages']);</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-ngMessages-directive/index.html" name="example-ngMessages-directive"></iframe> </div> </div> </p> </div>