Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

SVG 'image' tag in an external template file fails to compile #14222

Open
w1ndy opened this issue Mar 12, 2016 · 2 comments
Open

SVG 'image' tag in an external template file fails to compile #14222

w1ndy opened this issue Mar 12, 2016 · 2 comments

Comments

@w1ndy
Copy link

w1ndy commented Mar 12, 2016

Demo: http://plnkr.co/edit/SpX3Kf74NBgBvVJTFYQF

I tried to include a template for a SVG group, which contains a defs element of several pattern, but both image and circle elements disappeared in the final SVG as inspected with Chrome. However circle elements can be properly compiled if image elements are commented out.

Is this a bug? Or did I miss something that I should be aware of when using angular on SVG? Any hint is appreciated, thanks.

@Narretz
Copy link
Contributor

Narretz commented Mar 14, 2016

I assume there's a problem with the browser where it tries to parse the template content outside of the svg container. So the context isn't right and the image element gets garbled. What you can try is to either put the <svg> into the template or use a directive template, which works for some reason: http://plnkr.co/edit/GegJt1SSz4UcGgFRjiSk?p=preview

@w1ndy
Copy link
Author

w1ndy commented Mar 15, 2016

Directive template works magically, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants