I have an Angular 5 project that allows for a file upload, and I'd like to give the user an example/template file they can download first.
File structure
file-importer/
| file-importer.component.html
| file-importer.component.ts
| example-file-template.csv
In that HTML file I want to do something like this
<a href='example-file-template.csv' download>
Download a sample template here
</a>
But that link will be incorrect, so how am I supposed to link to static files like this?
Put your static files in the /assets
folder. It's a special folder in Angular, that's where you're supposed to put all your static files, images etc. Then link them like this :
<a href='assets/example-file-template.csv' download>
Download a sample template here
</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.