How to render a html using a string variable (holding template) - Angular4.
sample.component.ts
let stringTemplate = "<div><p>I should be rendered as a HTML<br></p></div>";
sample.component.html should be rendered based on elements in variable stringTemplate
NOTE: stringTemplate is not static. Will be getting its data from server.
You can bind to the innerHtml property.
<div [innerHtml]="stringTemplate"></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With