I'm trying to embed a pdf on my page using angular. I'm using the <objetct>
tag to do it. Basically I have 2 buttons, each button refreshes the url of the <object>
but does not load any. Why does this happen and how can I solve it?
<object *ngIf="pdf" [data]="pdf" type="application/pdf" width="100%" height="100%">
<p><b>Example fallback content</b>: This browser does not support PDFs. Please download the PDF to view it:
<a href=".pdf">Download PDF</a>.</p>
</object>
<button (click)="loadPdf1()">Load Pdf 1</button>
<button (click)="loadPdf1()">Load Pdf 2</button>
loadPdf1(){
this.pdf="http://www.africau.edu/images/default/sample.pdf"
}
loadPdf2(){
this.pdf="http://www.pdf995.com/samples/pdf.pdf"
}
this is my full code:
https://stackblitz.com/edit/angular-cygjuj?file=src/app/app.component.ts