JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myApp" ng-controller="myCtrl">
<div ng-repeat="row in list">
{{ row.value | picker:row.filter }}
</div>
<p>Using 'add' filter only to get 2 + 3 + 5 = {{ 2 | add:3:5 }}</p>
<p>Using useFilter' filter to call 'add' filter to get 7 + 9 + 11 =
{{ 7 | useFilter:'add':9:11 }}</p>
</div>
JavaScript
var app = angular.module('myApp', []);
app.filter('picker', function($filter) {
return function(value, filterName) {
return $filter(filterName)(value);
};
});
app.filter('useFilter', function($filter) {
return function() {
var filterName = [].splice.call(arguments, 1, 1)[0];
return $filter(filterName).apply(null, arguments);
};
});
app.filter('add', function() {
return function() {
var total = [].shift.apply(arguments);
while (arguments.length > 0) {
total += [].shift.apply(arguments);
};
return total;
};
});
app.controller('myCtrl', function($scope, $filter) {
$scope.list = [
{"value": "uppercase text", "filter": "uppercase"},
{"value": new Date(), "filter": "date" }
];
});