2015/10/02

AngularJS ng-list

ng-list:可以將指定的文字切割成清單

<!DOCTYPE html>
<html ng-app="myApp">
 <head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
  <script type="text/javascript">
   var myApp = angular.module('myApp', []);
   myApp.controller('myController', function($scope){
   });
  </script>
  <meta charset="utf8"/> 
  <title>Filter</title>
 </head>
 <body ng-controller="myController">
  <textarea ng-model="list" ng-list=";" ng-trim="false"></textarea>
  <pre ng-bind="list"></pre>
  <pre>{{list}}</pre>
 </body>
</html>


執行結果: