About ngList DirectiveThis directive is a spacial type of directive which can convert input text(String) into delimited string and an array of string. It means that ng-list directive can break the string.
To break the string or to convert string to an array of string, the delimiter is used. If no delimiter is fixed then by default comma(,) is used.
We can also define our own delimiter by using regular expression.
Syntax:
- <input ng-list="{string}">
- ...
- </input>
In the syntax {string} is option if we write like this then it will be default and comma will be used.
Example
- <!doctype html>
- <html ng-app>
- <head>
- <script src="angular.min.js"></script>
- </head>
-
- <body>
- By Default</br>
- List: <input name="namesInput1" ng-model="names1" ng-list>
- <tt>names = {{names1}}</tt><br/>
-
- User Defined</br>
- List: <input name="namesInput2" ng-model="names2" ng-list>
- <tt>names = {{names2}}</tt><br/>
- </body>
- </html>
Output