Angular 2 download .CSV file click event with authentication

后端 未结 2 888
灰色年华
灰色年华 2021-01-02 03:41

I\'m using a spring boot backend and my api uses a service to send data via an OutputStreamWriter. I can download this in Angular 2 using a click event like so:

2条回答
  •  鱼传尺愫
    2021-01-02 03:57

    I use FileSaver, too. If you have extension on client side, you can see that it will work properly for CSV files. You just need to add extension manually:

    FileSaver.saveAs(res, 'export' + extension);
    

提交回复
热议问题