Description :
Ng-list
directive display the textbox text in array form seprated by comma.Textbox value bind to list variable which will display the text.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app> <div> Name With (,) separate: <input type="text" ng-model="list" ng-list /><br /> <pre>Names:{{list}}</pre> </div> </body> </html>
Description :
Ng-list
directive display the textbox text in json format seprated by comma.Textbox value bind to name variable which will display the text.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app> <div> <p>Type comma ( , ) separated names.</p> <textarea ng-model="name" ng-list=","></textarea> <pre>{{name|json}}</pre> </div> </body> </html>
Description :
In this example the textbox is bind with the listNum array, when you type comma separated numbers in the textbox the ng-list
directive make list of the binded numbers and show in the json format.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="controllerName"> <p>Type comma ( , ) separated number.</p> <input type="text" ng-model="listNum" placeholder="Enter numbers" ng-list size=60> <pre>{{listNum|json}}</pre> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.listNum=[2,3,4] }]); </script> </body> </html>
Description :
Ng-list
directive display the textbox text in array form seprated by "-".Textbox value bind to list variable which will display the text.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="controllerName"> <p>Type dash ( - ) separated names.</p><input type="text" ng-model="list" ng-list="-"><br /> {{list}} </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.list = ["Learn", "It"]; }]); </script> </body> </html>
Description :
Ng-list
directive display the textbox text in json format seprated by "-".Textbox value bind to list variable which will display the text.Ng-trim
=false means it will not trim the value of textbox.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="controllerName"> <p>Type dash( - ) separated names.(ng-trim='false')</p><input type="text" ng-model="list" ng-list="-" ng-trim="false"><br /> <pre>{{list|json}}</pre> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.list = ["Learn", "It"]; }]); </script> </body> </html>
Description :
Ng-list
directive display the textbox text in json format.Textbox value bind to list variable which will display the text. It will not trim the input.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="controllerName"> <p>Type space (' ') separated names.</p><input type="text" ng-model="list" ng-list=" " ng-trim="false"><br /> <pre>{{list|json}}</pre> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.list = ["Learn", "It"]; }]); </script> </body> </html>
Description :
Ng-list
directive display the textbox text in json format.Textbox value bind to listvariable which will display the text. It will trim the value of input.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app> <div> <p>Type names.</p><input type="text" ng-model="list" ng-list=" " ng-trim="true"><br /> <pre>{{list|json}}</pre> </div> </body> </html>
Description :
Ng-List-8
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app> <div> <p>Enter Your Favourite colours name with comma seprated.</p><textarea ng-model="colours" ng-list ng-trim="true"></textarea><br /> </div> <h4>This is the list of your favourite colours.</h4> <ol> <li ng-repeat="colour in colours">{{colour}}</li> </ol> </body> </html>