How to download a file with Angular?

Posted by Rohit Kumar | Updated on

If you want to download a file with Angular? The problem is that the observable runs in another context, so when you try to create the URL var, you have an empty object and not the blob you want.

When the request is ready it will call the function “downloadFile” that is defined as follows:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers