AngularJS ng-list Directive

Definition and Usage

ng-list Directive converts a string to a string array using a comma as the default separator.

ng-list The directive can also perform the opposite conversion. If you have a string array that you want to display as a string in the input field, then use ng-list Directive.

ng-list The value of the attribute defines the separator.

Example

Convert user input to an array:

<div ng-app="">
<input ng-model="customers" ng-list/>
<pre>{{customers}}</pre>

Try It Yourself

Syntax

<element ng-list="separator</element>

Affected <input> and <textarea> Element Support.

Parameters

Parameters Description
separator Optional, define the separator, the default value is ", ".