I am trying to display a PDF file in an Angular2 component. The path of that PDF is dynamic and changes with the selection of the user.
Simply using data binding doesn't work:
<embed style="width: 100%; height: 100%" id="pdfDisplay" [src]="mailing.pdf" type="application/pdf"/>
The src
attribute will have the correct value but the PDF is not rendered - at least not in Chrome. As far as I know, this is due to the fact that the browser doesn't update if only the attribute changes.
In a non-angular application I got it to work by removing the embed tag completely and adding a new one.
Question: How to do that in Angular2?