File download in angular 2

14 views
Skip to first unread message

Alekhya Pulavarthi

unread,
Aug 28, 2018, 1:49:31 PM8/28/18
to Angular and AngularJS discussion
I am able to see the data of my file in response.but I need to download the file it may be image text Excel file

Sander Elias

unread,
Aug 28, 2018, 11:02:01 PM8/28/18
to Angular and AngularJS discussion

Hi Alekhya,

Why are you using Http to download the file? if you don’t need to content, just provide a link to it.

<a [src]='propertyFromControllerHoldingLink' target="blank">Download {{FileName}}</a>

Should do most of the work for you. If that’s not possible, you can convert your file to a dataUri, and then do the above with the resulting uri.

Regards
Sander

parwind...@appinventiv.com

unread,
Sep 5, 2018, 1:58:17 AM9/5/18
to Angular and AngularJS discussion
Use <a [href]="fileLink" download>
Reply all
Reply to author
Forward
0 new messages