I'm attempting to use filters within an AngularJS directive but not sure exactly how to do so. From some info on the mailing list it appears that you should be able to inject $filter and use it, but I'm not sure how/where to invoke it.
My directive currently looks like this:
myApp.directive('fancyDisplay', ['$filter', function($filter) {
return {
scope: {
'fancyDisplay': '='
},
template: "<div ng-repeat='datum in fancyDisplay | filter:tagFilter'>{{datum.name}}</div>"
};
}]);
Although the filter:tagFilter
isn't working. How should I filter my data in the directive?
JSfiddle available at http://jsfiddle.net/VDLqa/4/ Thanks in advance for any responses.