Resources:
Before submitting an issue, please consult our docs.
Stencil version: (run npm list @stencil/core from a terminal/cmd prompt and paste output below):
@stencil/[email protected]
I'm submitting a ... (check one with "x")
[ ] bug report
[x] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
I have a need where I get a string of html that I need to render as actual html. In react, you can do something like:
<div dangerouslySetInnerHTML={{
__html : '<h1>Test</h1>'
}} />
And that would output this:
<div>
<h1>Test</h1>
</div>
I've tried this with stencil:
const foo = '<h1>Test</h1>';
<div>
{foo}
</div>
And that encoded the html characters of course.
you should be able to use just innerHTML.
You are correct, never thought to try it but for anyone else that will be wondering, this works:
const foo = '<h1>Test</h1>';
<div innerHTML={foo} />
@mitchellsimoens awesome thanks for verifying
Most helpful comment
you should be able to use just
innerHTML.