Home > other >  How do I insert a link to download a PDF file in Angular?
How do I insert a link to download a PDF file in Angular?

Time:01-01

I am including an About page in an app I am writing. This page should contain a link that downloads a PDF file when it is clicked. Here is the about.component.html file:

<h1>About</h1>
<div >
    <p>
        Here is the first panel text.
    </p>
    <p>
        Here is the second panel text.
    </p>
</div>
<a ng-href="PDFFile.pdf" href="PDFFile.pdf">Download Information Sheet</a>

The link appears, but when I click on it, nothing appears. PDFFile.pdf is in the same directory as about.component.html. Am I missing something here?

CodePudding user response:

Move the pdf file to assets folder and change your link to "/assets/PDFFile.pdf".

  • Related