O'Reilly logo
  • Patrick S thinks this is interesting:

Directives are responsible for manipulating DOM within your application and provide a way to extend the HTML syntax with new functionality.

If you find yourself using $('element') in your controllers or services, best practices dictate that you move that code to a directive. This is usually because, whenever you use $('element'), the next code fragment that follows is one that manipulates DOM in one form or another.


Cover of AngularJS Services


Directive responsibilities