How to "evaluate" a <tag> retrieved from json?

I want to display a pdf with ng2-pdfjs-viewer`.
When I hard code in my homepage.html something like :

<ng2-pdfjs-viewert pdfSrc="myfile.pdf"><ng2-pdfjs-viewert>

It’s ok, but when the same string comes from a json, it’s not evaluated and nothing shows up.

But if I do the same with an <img> tag, it’s ok and it is evaluated to an image.

It seems to me that the browser knows what to do with img and does it, but is not told what to do by angular/ionic with ng2-pdfjs tag.

What can I do ? I think about ComponentFactoryResolver, but not clear to me.

It’s very hard for Angular to be able to know the trust level of stuff that comes “from a json”. Combining the security concerns with the performance issues involved when templates are not known at compile time, injecting random HTML into templates at runtime is deliberately discouraged, and if you can think of any way to avoid doing it, I would strongly encourage going that route.

For example, in this particular situation, if what needs to change dynamically is the pdfSrc value, how about trying to bind it like [pdfSrc]="dynamicPdfFileNameProperty"? This could be iterated using ngFor to display an arbitrary number of PDFs from a backing array property.