File download through Angular 2 : <p>I have a backend that I set up to return a file through setting the header</p>

<pre><code>Content-Disposition: attachment;filename=somefile.csv
</code></pre>

<p>It works directly in the browser and downloads the file immediately upon invoking the URL that points to that resource.</p>

<p>My goal is to have a button in an Angular 2 template. When the user clicks that button, I'd need to collect some data from the client-side (some IDs) and send it to the server to invoke that file download URL.</p>

<p>I'd like the user to stay on the same page and not have any new tabs open up but simply have the file start downloading (just like when the URL is invoked directly).</p>

<p>It will need to be done through a <strong>POST request</strong> because I can have quite a bit of data to send to identify what resource needs to be downloaded.</p>

<p>What does the call on the Angular 2 side look like for this? I tried a couple of things but I am obviously on the wrong path.</p>

<p>Any help would be appreciated!</p>
