AngularJS ng-listDirective
AngularJS Example
Convert user input to an array:
<div ng-app="">
<input ng-model="customers" ng-list/>
<pre>{{customers}}</pre>
<input ng-model="customers" ng-list/>
<pre>{{customers}}</pre>
Try it Yourself »
Definition and Usage
ng-listThe directive converts a string to an array, separated by commas.
ng-listThe directive also has another conversion method. If you have a string array that you want to display in the input box, you can use theng-listdirective.
ng-listThe attribute value defines the delimiter.
Syntax
<element ng-list="separator"></element>
<input>, <select>, <textarea>, and other editable elements support this directive.
Parameter Values
| Value | Description |
|---|---|
| separator | Optional. Defines the delimiter. Defaults to", " |
Other Extensions
AngularJS Reference Manual