Answer provided by @Prashanth is correct, but there is even easier way of doing the same. Basically instead of injecting the $filter
dependency and using awkward syntax of invoking it ($filter('filtername')(arg1,arg2);
) one can inject dependency being: filter name plus the Filter
suffix.
Taking example from the question one could write:
function myCtrl($scope, filter1Filter) {
filter1Filter(input, arg1);
}
It should be noted that you must append Filter
to the filter name, no matter what naming convention you're using:
foo is referenced by calling fooFilter
fooFilter is referenced by calling fooFilterFilter