I'm just looking into the Svelte framework for an upcoming project.
I was wondering (as it's a project requirement) whether it's possible to load some HTML string from a server (using the fetch api) and insert this into a Svelte component dynamically.
It seems possible to output HTML strings using {@html my_html_string}
. Is there any way to have the tags for actual Svelte elements within the HTML string?
e.g.
<script>
// import MyCustomElementHere....
let my_html_string = 'Some text <MyCustomElement/> some more text';
</script>
<p> {my_html_string} [somehow??] </p>
I was thinking this might be possible by turning a component into a Custom Element (or something), but I haven't managed to make this work (probably as I don't know enough about the framework yet).
Does anyone know if it's actually possible?