0

I'm making frontend with Angular and backend with rails. I have a function to render pdf and return url of it. PDF is populated in format of /public/rendered/*.pdf.

After I make the pdf I call a function called openInNewTab

window.open(response.data["path"].split("/")[1]);

However, it is giving me an error saying

No route matches [GET] "/public/rednered/8-64dde64b-5548-4596-96a0-27b11ca51e2e.pdf"

I confirm that the pdf file exists. How do I show a pdf file in new tab?

Kahsn
  • 1,045
  • 3
  • 15
  • 25

1 Answers1

0

I assume by the function name that you want to open the PDF in a new tab, if so, you're missing the 2nd parameter. It should be:

window.open(response.data["path"].split("/")[1],"_blank");
Mike Feltman
  • 5,160
  • 1
  • 17
  • 38