EVOLUTION-MANAGER
Edit File: ngList.html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/ng/directive/ngList.js?message=docs(ngList)%3A%20describe%20your%20change...#L4' 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/ng/directive/ngList.js#L4' 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">ngList</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - directive in module <a href="api/ng">ng</a> </li> </ol> </header> <div class="api-profile-description"> <p>Text input that converts between a delimited string and an array of strings. The default delimiter is a comma followed by a space - equivalent to <code>ng-list=", "</code>. You can specify a custom delimiter as the value of the <code>ngList</code> attribute - for example, <code>ng-list=" | "</code>.</p> <p>The behaviour of the directive is affected by the use of the <code>ngTrim</code> attribute.</p> <ul> <li>If <code>ngTrim</code> is set to <code>"false"</code> then whitespace around both the separator and each list item is respected. This implies that the user of the directive is responsible for dealing with whitespace but also allows you to use whitespace as a delimiter, such as a tab or newline character.</li> <li>Otherwise whitespace around the delimiter is ignored when splitting (although it is respected when joining the list items back together) and whitespace around each list item is stripped before it is added to the model.</li> </ul> <h3 id="example-with-validation">Example with Validation</h3> <p> <div> <a ng-click="openPlunkr('examples/example-ngList-directive')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-ngList-directive" name="ngList-directive" module="listExample"> <div class="runnable-example-file" name="app.js" language="js" type="js"> <pre><code>angular.module('listExample', []) .controller('ExampleController', ['$scope', function($scope) { $scope.names = ['morpheus', 'neo', 'trinity']; }]);</code></pre> </div> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><form name="myForm" ng-controller="ExampleController"> List: <input name="namesInput" ng-model="names" ng-list required> <span class="error" ng-show="myForm.namesInput.$error.required"> Required!</span> <br> <tt>names = {{names}}</tt><br/> <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/> <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form></code></pre> </div> <div class="runnable-example-file" name="protractor.js" type="protractor" language="js"> <pre><code>var listInput = element(by.model('names')); var names = element(by.exactBinding('names')); var valid = element(by.binding('myForm.namesInput.$valid')); var error = element(by.css('span.error')); it('should initialize to model', function() { expect(names.getText()).toContain('["morpheus","neo","trinity"]'); expect(valid.getText()).toContain('true'); expect(error.getCssValue('display')).toBe('none'); }); it('should be invalid if empty', function() { listInput.clear(); listInput.sendKeys(''); expect(names.getText()).toContain(''); expect(valid.getText()).toContain('false'); expect(error.getCssValue('display')).not.toBe('none'); });</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-ngList-directive/index.html" name="example-ngList-directive"></iframe> </div> </div> </p> <h3 id="example-splitting-on-whitespace">Example - splitting on whitespace</h3> <p> <div> <a ng-click="openPlunkr('examples/example-ngList-directive-newlines')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-ngList-directive-newlines" name="ngList-directive-newlines"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><textarea ng-model="list" ng-list="&#10;" ng-trim="false"></textarea> <pre>{{ list | json }}</pre></code></pre> </div> <div class="runnable-example-file" name="protractor.js" type="protractor" language="js"> <pre><code>it("should split the text by newlines", function() { var listInput = element(by.model('list')); var output = element(by.binding('list | json')); listInput.sendKeys('abc\ndef\nghi'); expect(output.getText()).toContain('[\n "abc",\n "def",\n "ghi"\n]'); });</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-ngList-directive-newlines/index.html" name="example-ngList-directive-newlines"></iframe> </div> </div> </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"> <ul> <li>as attribute: <pre><code><input [ng-list=""]> ... </input></code></pre> </li> </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> ngList <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>optional delimiter that should be used to split the value.</p> </td> </tr> </tbody> </table> </section> </div>