title: Link vs compile vs controller
body: <p>When you create a directive, you can put code into the compiler, the link function or the controller. </p>
  
  <p>In the docs, they explain that:</p>
  
  <ul>
  <li>compile and link function are used in different phases of the angular
  cycle</li>
  <li>controllers are shared between directives</li>
  </ul>
  
  <p>However, for me it is not clear, which kind of code should go where.</p>
  
  <p>E.g.: Can I create functions in compile and have them attached to the scope in link or only attach functions to the scope in the controller?</p>
  
  <p>How are controllers shared between directives, if each directive can have its own controller? Are the controllers really shared or is it just the scope properties?</p>