AngularJS ng-list directive
AngularJS instance
Convert user input to an array:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body><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 directive, your input information is converted into an array, as shown below:</p><pre>{{customers}}</pre></div></body></html>Definition and usage
The ng-list directive converts strings to arrays and is separated by commas.
There is another way to convert the ng-list directive. If you have a string array that wants to be displayed in the input box, you can use the ng-list directive on input.
The ng-list property value defines the separator.
grammar
<element ng-list="separator"></element>
<input>, <select>, <textarea>, and other editable elements support this directive.
Parameter value
| value | describe |
|---|---|
| separator | Optional, define the delimiter, default is ", " |
The above is the information sorting out the AngularJS ng-list instruction. We will continue to sort out the relevant information in the future. Thank you for your support!