angularjs ng-list directive

angularjs example

Convert user input to an array:

<! Doctype html>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<div ng-app="">
<p>In the input box,Enter some text,And separate them with commas:</p>
<input ng-model="customers" ng-list />
<p>When using the ng-list instruction, your input information is converted to an array,It looks like this:</p>

Definition and usage

The ng-list instruction converts a string into an array,And separated by commas.

The ng-list attribute value defines the delimiter.


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

<input> ;,<select> ;,<textarea> ;, and other editable elements support the directive.

Parameter value

value description
separator Optional, define a separator,The default is", "

  • Previous JS method for randomly taking out several array elements from an array
  • Next iOS implements the cute owl login interface animation