title: Angular: Directives vs Pipes
body: <p><strong>What are the arguments for creating and using directives vs creating and using pipes.</strong> </p>
  
  <p>The scenario this question stems from is around currency input and output. </p>
  
  <p>If a user needs to input a currency, why not create/use a directive that parses the input into a formatted currency string? The other option is to take in that string, and display it through a pipe like so:</p>
  
  <pre><code>&lt;input type="text" #val (keydown)="currencyVal=val.value" /&gt;
  &lt;h3&gt;{{currencyVal | currency}}&lt;/h3&gt;
  </code></pre>
  
  <p><em>vs</em></p>
  
  <pre><code>// Where mask-money is a directive that filters the 
  //input to a formatted currency string
  &lt;input type ="text" mask-money (keydown)="currencyVal=val.value" /&gt;
  &lt;h3&gt;{{currencyVal}}&lt;/h3&gt;
  </code></pre>
  
  <p>On the other hand, a pipe can be used in the controller/component triggered by an input to filter the value.</p>
  
  <p>I could ask a ton of questions about it, but I basically want to know: <strong><em>what are the arguments for each?</em></strong> </p>