This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
ng-href behavior to add xlink:href as well as href attributes in SVG - USE #15618
Open
Description
Do you want to request a feature or report a bug?
I am not sure whether this is a bug or request for new feature.
What is the current behavior?
I was using inline svg like:
<svg>
<use xlink:href="#logo"></use>
</svg>
But then I came to know that xlink:href
attribute is deprecated. and in future, use
will support href
attribute. So, to support both modern and bit old browsers, I was using the following code (which is working):
<svg>
<use xlink:href="#logo" href="#logo"></use>
</svg>
Then I made this to a directive. So that I can manage this code easily. In directive's html, I wrote the code as follows:
<svg>
<use ng-href="{{ '#' + svgHref }}" xlink:href=""></use>
</svg>
This is generating the HTML to:
<svg>
<use ng-href="#logo" xlink:href="#logo"></use>
</svg>
As you can see, the href
attribute is missing which I was thinking that ng-href
will handle automatically.
Current Angular Version: 1.6.1