Skip to content

target="_blank" ui-sref's with slashes get converted to %2F (even when using custom param type) #1741

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

Closed
mismith opened this issue Feb 9, 2015 · 11 comments

Comments

@mismith
Copy link

mismith commented Feb 9, 2015

Using the following custom type:

    // fix '/' rewriting to '%2F'
    $urlMatcherFactoryProvider.type('UriPath', {
        encode: function(v){ return v || ''; },
        decode: function(v){ return v || ''; },
        is:     function(v){ return true; },
    });

The following:

<a ui-sref="page({path: 'lots/of/slashes'})" target="_blank">Click me</a>

Opens the following / generates the following href:

/lots%2Fof%2Fslashes

Where I would expect:

/lots/of/slashes

Live plnkr showing this bug: http://plnkr.co/edit/7WbNArmXm2p3scQUzWHh?p=preview

The expected behaviour does seem to work when there is no target="_blank" attribute on the link. How can I work around this?

@mismith mismith changed the title target="_blank" ui-sref's with slashes get converted to %2F (even when using custom param type) target="_blank" ui-sref's with slashes get converted to %2F (even when using custom param type) Feb 9, 2015
@derzwen
Copy link

derzwen commented Mar 12, 2015

I have the same problem as well, but always. It doesn't matter if there's a target="_blank" oder not.

If i open your provided punkr, i always see the encoded URLs independent of the target attribute. How did you get this working without a target attribute? From my point of view, it never works....

@mismith
Copy link
Author

mismith commented Apr 1, 2015

Any update on this?

@mismith
Copy link
Author

mismith commented Apr 8, 2015

Simplified plunkr from #1119: http://plnkr.co/edit/tNlRmadZRUGRPHhrKqTQ?p=preview

@jomonkj
Copy link

jomonkj commented Jul 29, 2015

+1 i have same problem

@jomonkj
Copy link

jomonkj commented Jul 29, 2015

solved by this http://jsfiddle.net/jylinman/rm1Lbptf/1/

@mismith
Copy link
Author

mismith commented Jul 29, 2015

@jomonkj that fiddle does not solve the problem for me on Chrome 44.0.2403.89 for Mac OS X 10.10.4
(see both hovered URL at bottom left and raw URL next to link) image

@jomonkj
Copy link

jomonkj commented Jul 30, 2015

@mismith you are correct. jsFiddle code only work with firefox. Issue remains with IE and Chrome

@mismith
Copy link
Author

mismith commented Aug 25, 2015

Still need a solution, despite #1119, #1645, and many others.. I would love to help, but it requires core changes that I don't think I'd be able to make without at least some kind of approval from someone on the ui-router team

@paveleremin
Copy link

@mismith 👍 for the report, I have the same issue. Did you resolve it some how?

@ghost
Copy link

ghost commented May 31, 2016

@mismith Getting the same issue, you found any solution for this ?

@christopherthielen
Copy link
Contributor

This is addressed in 1.0 using raw parameter or parameter types.

http://plnkr.co/edit/bOEIgRN4SHD8mpaMko2W?p=preview

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

5 participants