Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

AngularJS ng-list Directive


Example

Convert user input into an array:

<div ng-app="">

<input ng-model="customers" ng-list/>

<pre>{{customers}}</pre>
Try it Yourself »

Definition and Usage

The ng-list directive converts a string into an array of strings, using a comma as the default separator.

The ng-list directive also converts the other way around, if you have a array of strings you wish to display in an input field as a string, then put the ng-list directive on the input field.

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


Syntax

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

Supported by <input> and <textarea> elements.


Parameter Values

Value Description
separator Optional, defines the separator, default value is ", "