That's the worst way of implementing it.
1) If you need to evaluate something from attrs, just define it in the scope property from the directive and Angular will do the magic:
{value: '&'}
2) For reusing it, you should use an isolated scope
3) Also className should be actually used with ng-class and that should be done in the HTML of the directive.
4) You shouldn't modify the DOM from the directive. That should be modified by itself when puting values from the scope in the HTML of the directive.
I think this is not teaching people how it's the right way to do it.