AngularJS Filters

4,244 views

Published on

AngularJS Filters

Published in: Technology, Business

AngularJS Filters

  1. 1. {{ expression [| filter_name[:parameter_value] ... ] }}<input type="text" ng-model="inputFilter" /><ul><li data-ng-repeat="n in names| orderBy:name | filter : inputFilter ">{{name}}</li></ul>
  2. 2. Filters
  3. 3. angular.module("demo", []).filter(reverse, function () {return function(input, uppercase) {var out = "";for (var i = 0; i < input.length; i++) {out = input.charAt(i) + out;}// conditional based on optional argumentif (uppercase) {out = out.toUpperCase();}return out;};});Reverse: {{ greeting | reverse }}<br>Reverse + uppercase: {{ greeting | reverse : true }}<br>
  4. 4. Custom Filters

×