AngularJS Basic ng list Instruction Detailed Explanation and Sample Code

  • 2021-07-07 06:22:16
  • OfStack

AngularJS ng-list Directive

AngularJS instance

Convert user input into 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 1 Some text, and separate them with commas: </p>

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

<p> When using  ng-list  Command, your input information will be converted into an array, as follows: </p>

<pre>{{customers}}</pre>

</div>

</body>
</html>

Definition and usage

The ng-list directive converts strings into arrays, separated by commas.

The ng-list command has another conversion mode. If you have an array of strings that you want to display in the input box, you can use the ng-list command on input.

The ng-list attribute value defines the delimiter.

Grammar

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

< input > , < select > , < textarea > And other editable elements support this directive.

Parameter value

描述
separator 可选,定义分隔符,默认为", "

The above is the data collation of AngularJS ng-list instructions, and continue to collate relevant data in the future. Thank you for your support!


Related articles: