Can I use filters in directives as well as controllers?
Imagine injecting the filter into a directive like this...
app.directive('ngDirective',
['$compile','$filter',
function ($compile, $filter) {
'use strict';
Then, within the link function, having the following code.
var filter = $filter('i18n');
var requiredMessage = filter('is_required');
I understand that when using directives, $scope can be lost which may cause issues.
EDIT: Check out the plunker to see the code preview http://plnkr.co/edit/u1L9SHdAvZnvEqwVBeJg
Any suggestions on resolving this problem?