-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Description
Hi everybody, this is my first time reporting a bug/ asking for feature un Github. Be kind :)
[x] bug report
[x] feature request
[ ] support request
Current behavior
if I have a parent template defining a root svg tag such as
<svg xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <xhtml:router-outlet></router-outlet> </svg>
And a routed component's template that looks like
<svg:g> <svg:circle cx=0 cy=0 r="40" stroke="black" stroke-width="3" fill="red" /> </svg:g>
The routed component's host is not define as belonging to svg namespace.
I have tried to with the @component selector property, but to no avail.
For reference the following doesn't work:
@Component({ selector: 'svg:g[my-attr-selector]' }
Note that using svg[my-attr-selector]
does render properly (as expected, since svg is valid in html namespace), this might be useful for others with similar problem but different requirements.
Unfortunately it doesn't cut it for me, I need my parent's svg to be the root svg for my routed component.
Expected behavior
Ideally it would be nice to be able to prefix the Component's selector as I have tried.
Or even better would be to have a property in the Component's decorator to tell angular which namespace the host element is supposed to belong to.
Currently: my selector 'svg:g[my-attr-selector]' gets parsed and rendered by angular as just a g tag. Completely cleaning off the prefix.
And that g tag is not an svg element thus none of the content is rendered.
Minimal reproduction of the problem with instructions
Simply drop a router-outlet inside svg tags and route a child component with svg template. This will not work unless the child component's host is svg
What is the motivation / use case for changing the behaviour?
being able to use the power of angular/router anywhere in an app seems pretty compelling to me :)
Details about my implementation and requirements are kind of irrelevant.
But let's just mention that the workarounds I have found are all messy, inelegant, and overall create complexity in my code where a router-outlet would be much better.
Please tell us about your environment:
Mac OSX El capitan
-
Angular version:
angular4.0.0
angular/router4.0.0 -
Browser:
Chrome latest (59.0.3071.86) -
Language:
-
Node (for AoT issues):