I've been working with an angular controller that pulls json data from my server and displays it dynamically. Here's the code snippet for showing images:
<div ng-controller="myImgController">
<div ng-repeat="img in imgs">
<div ng-repeat="i in img">
<img ng-src="{{i.id}}"/>
</div>
</div>
</div>
Now, my challenge is to generate markup dynamically to display PDFs within the browser using a similar approach. This is what I have so far:
<div ng-controller="myNewPdfController">
<div ng-repeat="pdf in pdfs">
<div ng-repeat="p in pdf">
<object ng-attr-data="{{p.id}}" type="application/pdf" width="100%" height="100%"></object>
</div>
</div>
</div>
I'm facing issues with ng-attr-data / ng-src
not properly updating the PDF source. Just to clarify, the p.id
contains the URL of the PDF file.
If anyone has a solution or suggestions to tackle this problem effectively, please feel free to share. There are various resources available, but I wanted to present a clear question for others facing a similar issue.