title: When to write a directive?
body: <p>Angular provides us with a mechanism to write directives - which is extremely powerful in what it can do. But the thing I keep wondering is - in what scenario should you be actually writing a custom directive of your own. </p>
  
  <p>We keep seeing questions in and around Stack Overflow with various people attempting to write directives which ( in my opinion ) need not be written in the first place. In most cases they can be solved with a combination of repeat, switch and show. See examples of questions containing directives that I think shouldnt be directives in the first place!</p>
  
  <p><a href="https://stackoverflow.com/questions/16101073/angularjs-directive-is-not-working-in-ie-10">https://stackoverflow.com/questions/16101073/angularjs-directive-is-not-working-in-ie-10</a></p>
  
  <p><a href="https://stackoverflow.com/questions/16080461/fire-button-click-in-angularjs">Fire button click in AngularJS</a></p>
  
  <p><a href="https://stackoverflow.com/questions/16057187/angularjs-using-a-directive-inside-the-ui-bootstrap-modal">angularjs: using a directive inside the ui-bootstrap modal</a></p>
  
  <p>Some examples scenarios. I am not picking on them in anyway..because I am sure it is not clear to anyone when we should be using / writing a directive.</p>
  
  <p>We see scenario's where people use directives as a mechanism for templating. Is this the right way of doing things? Or is there a better way? ( ng-include perhaps? ) Are there any upsides / downsides to using directives as a templating mechanism? The reason for this question is that sometimes I wonder if people write directives because coming from the jquery world the first thing they can think of is writing DOM manipulating code and since the Angular way is to not manipulate the DOM in controllers it all gravitates towards writing all that code in a directive. </p>
  
  <p><strong>EDIT :</strong> </p>
  
  <p>I believe this confusion ( of shoving things inside a directive ) arises because Angular does not have a separate concept of a "view" - unlike Backbone ( which only has a "view" but no component! ). Directives are amazing at defining components - But I think if you use them to create "views", you will lose some of the "angular" way. This is my opinion though -which is why I am soliciting what the rest of the angular community thinks. </p>
  
  <p>The good thing about simpler directives ( directives that do just 1 thing! ) is that they are absolutely easy to test. If you look at all the ng directives they all do 1 thing and do that thing pretty well. </p>
  
  <p>What is the best way of defining reusable "views" ( not components! ) in Angular ?  Should that be written in a directive? Or is there a better way? </p>
  
  <p>It would be awesome if one of the Angular Dev's have an opinion in this matter!</p>