lundi 11 juillet 2016

EmberJS: Get PDF in a new window tab from server using link

I want to use the default behavior of a browser to open a pdf file in a new tab using Ember.
I'm not using Ember-Data and as a server side resource I'm using Python. So I set the proxy address on startup of Ember to point to server side address.

I built a route page and I have a link to open my PDF file in the browser like

<a href="/path/apps/list.pdf?list=current" target="_blank">Open</a>

And the server Python resource returns a pdf:

@get("/list.pdf")
def get_list_pdf(crew):   
    //some code to build the pdf string 
    Response(pdf_string, headers={'Content-Type': 'application/pdf'})

I tried it in an application without ember to access the resource from a link and it is fine. But with Ember I'm not able to do that.

Any suggestions how I can achieve that?




Aucun commentaire:

Enregistrer un commentaire