Is it possible to download a file (e.g. Power point presentation) through a link when an igx Button is clicked? I could not find any related topic to my question.
Here is my example code:
<button igxButton="raised" (click)="downloadFile()" class="downloadBtn">
Download File
</button>
and the function:
downloadFile() {
let exampleLink = "https://downloadexamplefile.com/fileid123"
}
Thank you!
This functionality is not specific to the igxButton. The button may be a tirgger for the download action, although the actual action is something that you will need to handle.
An example would be creating a Service and specifying the responseType option that upon GET request can return a blob representing the downloaded file. Then you can call this service, subscribe to the corresponding observable, and eventually save the file upon igxButton click
Example: https://www.thecodehubs.com/download-file-with-httpclient-in-angular/