After discovering that template files can now be saved as .svg
rather than .html
, I decided to create svg components for use like so.
main.component.svg
<svg>
<my-svg-component></my-svg-component>
</svg>
mySvg.component.svg
<text x="0" y="60">test text</text>
However, when I received an error stating that <text></text>
was not a recognized element, I made the following modification:
<svg:text x="0" y="65">test text</svg:text>
The error disappeared, but nothing is rendering. When I added the script directly into the <svg>
tag in the main.component.svg
file without using svg:
at the beginning, it worked fine.
Do I need to do something specific in the mySvg.component
template to make this work as a reusable component or should all of the SVG generation happen within one single template?
UPDATE
I attempted to utilize SVG's <foreignObject>
like this
<svg>
<foreignObject>
<my-svg-component></my-svg-component>
</foreignObject>
<svg>
This method also did not yield results. Testing with a paragraph tag, I realized that I had to use <xhtml:p>
for it to render properly. Even after adding the xhtml:
part to my component, there was still no visible output. Now, I am contemplating if there may be an angular:
equivalent that could be used instead.