I am writing an Angular application and I have an HTML response I want to display.
How do I do that? If I simply use the binding syntax {{myVal}}
it en
Just to post a little addition to all the great answers so far: If you are using [innerHTML]
to render Angular components and are bummed about it not working like me, have a look at the ngx-dynamic-hooks library that I wrote to address this very issue.
With it, you can load components from dynamic strings/html without compromising security. It actually uses Angular's DOMSanitizer
just like [innerHTML]
does as well, but retains the ability to load components (in a safe manner).
See it in action in this Stackblitz.