I am creating an angular component that displays a highlighted HTML code and the result of it's execution. The displayed HTML code lives inside a pre html element, as for the preview of the result, it's hard-coded :
<pre class="prettyprint lang-html">
<button type="button" class="btn btn-danger">Danger</button> <br> <p> Hello World! </p>
</pre>
<button type="button" class="btn btn-danger">Danger</button>
<p> Hello Wolrd </p>
The result of using this component is as following
Now what I want to do is to pass this HTML code as an input to this component. I tried to pass the code as a string using the following string :
<button type=\"button\" class=\"btn btn-danger\">Danger</button> <br> <p> Hello World! </p>
The input what displayed as a string and was not executed displayed as an HTML code : image
How can i use this input string to 1. display it as html code and 2. execute this code to preview the result ? Otherwise, what's the type that i should use for the input ?
Thanks for you're help.