Spring - download response as a file

前端 未结 7 719
無奈伤痛
無奈伤痛 2020-12-08 07:19

I am writing application using AngularJS and Spring. I would like to send request to the server and download response returned from controller as a file. In controller I hav

7条回答
  •  一生所求
    2020-12-08 07:45

    It is possible to download a file using XHR request. You can use angular $http to load the file and then use Blob feature of HTML5 to make browser save it. There is a library that can help you with saving: FileSaver.js.

提交回复
热议问题