ember.js - Downloading files with Ember app -
i have ember app (built ember-cli). on backend have rails application handles requests. lets api has following routes:
/model
— returns list of models
/model/1
— returns model
/model/1/download
— returns file
how can force ember app start file download (using /download
path) , how can construct link file download within ember app?
- if you're going hit endpoint , return file contents, believe you'll need set content disposition header. more details here: force download through js or query
content-disposition=attachment; filename=some.file.name
- if linking file directly, use html5
download
attribute;
<a href="{{model.download}}" download>download file</a>
Comments
Post a Comment