AngularJs | ng-list Directive
The ng-list Directive in AngularJS is used for separating input string and convert it into an array of string using a separator. By default comma is used as a default separator. But any custom separator can be used as value of ng-list directive.
Syntax:
<element ng-list="delimiter"> Contents... </element>
The value of ng-list specifies the separator to be used for separating the input string.
Example: This example uses ng-list Directive to convert input into array.
<!DOCTYPE html> <html> <head> <title>ng-list Directive</title> <script src= </script> </head> <body ng-app="app" style="text-align:center"> <h1 style="color:green">GeeksforGeeks</h1> <h2>ng-list Directive</h2> <div ng-controller="geek"> <p>Enter Input: <input type="text" ng-model="list" ng-list="-"> </p> {{list}} </div> <script> var app = angular.module("app", []); app.controller('geek', ['$scope', function ($scope) { $scope.list = []; }]); </script> </body> </html> |
Output:

Recommended Posts:
- AngularJS | ng-cut Directive
- AngularJS | ng-app Directive
- AngularJS | ng-value Directive
- AngularJS | ng-if Directive
- AngularJS | ng-src Directive
- AngularJS | ng-csp Directive
- AngularJS | Directive
- AngularJS | ng-jq Directive
- AngularJS | ng-srcset Directive
- AngularJS | ng-readonly Directive
- AngularJS | ng-paste Directive
- AngularJS | ng-selected Directive
- AngularJS | ng-required Directive
- AngularJS | ng-options Directive
- AngularJS | input Directive
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



