This is an interesting question. Usually you do something like this or something like this:
var translatedValue = $filter('translate')('ACTIVE'); var lowercaseValue = $filter('lowercase')(translatedValue); $scope.finalValue = $filter('limitTo')(lowercaseValue, 5)
I created a service inspired by this answer .
app.service('FilterChain', ['$filter', function($filter) { var chain = { value : '', start : function(value) { this.value = value; return this; }, applyFilter : function(filterName, args) { args = args || []; args.unshift(this.value); this.value = $filter(filterName).apply(undefined, args) return this; } }; return chain; }]);
Use of this type
$scope.value = FilterChain.start('Active') .applyFilter('translate') .applyFilter('limitTo', [5]) .applyFilter('uppercase') .value;
You can use this service with other filters and objects, such as arrays. See a working example here: JSFiddle
source share