title: Angular trigger a download on api response with filename
body: <p>I am using angular and laravel. on a post request PHP creates a file and responds with the filename. How to use that filename and trigger download from angular.</p>
  
  <p>api request</p>
  
  <pre><code>    var promise = $http.post('api/admin/ecs/singleecs', data).
          success(function (response) {
               //trigger file download
      })
  </code></pre>
  
  <p>php</p>
  
  <pre><code>PDF::loadHTML($html)-&gt;setPaper('a4')-&gt;setWarnings(false)-&gt;save('public/temp/'.$filename.'.pdf');
  return $filename;
  </code></pre>