Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui-sref inside inlcuded svg stopped to work since 0.2.11 #1667

Closed
martinoss opened this issue Jan 3, 2015 · 3 comments
Closed

ui-sref inside inlcuded svg stopped to work since 0.2.11 #1667

martinoss opened this issue Jan 3, 2015 · 3 comments

Comments

@martinoss
Copy link
Contributor

I included an SVG image with some links (ui-sref) in my project using ng-include.
After I upgraged from 0.2.10 to 0.2.13, the links are no more getting invoked. It turned out that it's broken since 0.2.11.

Here is an example:
http://plnkr.co/edit/uod9jpkySgYsXya66v51?p=preview
If you change the included ui-router script to 0.2.11 or 0.2.13, clicking the svg has no effect.

The issue should be easy to fix:
In the directie $StateRefDirective there is a check if the element is an anchor element:
isAnchor = element.prop("tagName") === "A";
In case of the SVG, the tag name was lowercase ("a").
isAnchor = element.prop("tagName").toUpperCase() === "A"; will to the trick.

martinoss added a commit to martinoss/ui-router that referenced this issue Jan 3, 2015
Fix the tagName comparism to make ui-sref also work inside an SVG.
martinoss added a commit to martinoss/ui-router that referenced this issue Jan 3, 2015
martinoss added a commit to martinoss/ui-router that referenced this issue Jan 3, 2015
Fix the tagName comparism to make ui-sref also work inside an SVG.
martinoss added a commit to martinoss/ui-router that referenced this issue Jan 3, 2015
…ar-ui#1667

Set the correct attribute when dealing with an SVG anchor element.
Otherwise, angular will prevent the click.
martinoss added a commit to martinoss/ui-router that referenced this issue Jan 5, 2015
nateabele added a commit that referenced this issue Jan 6, 2015
fix($StateRefDirective): resolve support for svg anchor elements #1667
@nateabele
Copy link
Contributor

Looks good. Feel free to submit those commits as a PR and I'll get them merged, thanks.

@martinoss
Copy link
Contributor Author

See this PR #1668, thanks for merging.

@nateabele
Copy link
Contributor

Thanks for the fix.

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

No branches or pull requests

2 participants