O'Reilly logo
  • Sam Ghanekar thinks this is interesting:

myApp.directive("highlight", function ($filter) {
 
    var dayFilter = $filter("dayName");
            
    return function (scope, element, attrs) {
        if (dayFilter(scope.day) == attrs["highlight"]) {
            element.css("color", "red");
        }
    }
});

From

Cover of Pro AngularJS

Note

Neat - adding a filter to be used inside of a directive