A
A
Andrey Astafiev2016-04-22 15:37:09
Angular
Andrey Astafiev, 2016-04-22 15:37:09

How to download pdf file from server using angular?

With the help of $http using the POST method, I make a request to the server where a pdf file is generated for me. How can I force Angular to download what it generated for me?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Sergeev, 2016-04-22
@SergeevAI

Why the hell do you need to hang unnecessary things on the frontend?
This is a purely server task, send a request, accept a response, recognize and process.

V
Vlad Lavrik, 2016-04-22
@lavrok

It is more correct for the server to specify the header 'Content-Disposition: attachment; filename="name.pdf", which will force the files not to be opened, but to be downloaded. And in the browser "go" to the url to the file using location

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question