title: What's the best way to use Symfony2 to serve AngularJS partials?
body: <p>I'm not sure how I should be serving partials from Symfony to Angular.</p>
  
  <p>I was thinking I should set up a route in Symfony, and then have the controller output the file?</p>
  
  <p>I wasn't sure however how to simply output a file from the controller (i.e. no twig stuff, not really rendering anything, etc.)  And will this method cache it properly?</p>
  
  <p>For example,if I want angular to download partials/button.html, should I set up a route like:</p>
  
  <pre><code>partials:
      pattern:  /web/partials/{partial}
      defaults: { _controller: AcmeWebBundle:Partials:show, _format: html }
  </code></pre>
  
  <p>Then, in my controller have,</p>
  
  <pre><code>...
  public function showAction() {
      return file_get_contents(' ... path to file ...');
  }
  ....
  </code></pre>
  
  <p>That obviously doesn't work.. I'm not sure how to output just a straight file without going through twig.  Or maybe all my partials should just be twig files (just without any twig stuff in them)?</p>