I have a url for ex: abc.net/files/test.ino The requirement is to download an .INO file through a button click event in angular 5 or 6
you can create an anchor tag to download the file on button click event
downloadMyFile(){
const link = document.createElement('a');
link.setAttribute('target', '_blank');
link.setAttribute('href', 'abc.net/files/test.ino');
link.setAttribute('download', `products.csv`);
document.body.appendChild(link);
link.click();
link.remove();
}
now call this function from your button
<button (click)="downloadMyFile()">download File<button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With