Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Upgrade

AngularJS ng-list Directive


Convert user input into an array:

<div ng-app="">

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

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.


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

Supported by <input> and <textarea> elements.

Parameter Values

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