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
[Alpha 44][Router] Parenthesis in urls #4895
Comments
@ocombe FYI: encodeURIComponent does not encode ( or ). Are you sure that you get "The%20Player%20" in your RouteParams on your first try after encoding? I do not see that behaviour, I get "The%20Player%20(2015)" as expected. |
Yes I know that it doesn't encode parenthesis, but I tried it before discovering auxiliary routes, which seems to be the problem here. Because it works until I refresh the page and then the router gets fooled when analyzing the url :-/ |
OK I temporary fixed this problem by running all my routes through an extended encodeURIComponent function: encodeURIComponent(str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16);
});
} Still it would be nice to have this built into the router. |
I have the same issue with Component router in Angular 2 RC1 |
HI ocombe. Did you find a solution for parenthesis on url parameters? This issue still exists in RC4! |
I haven't retried since then |
Could you please open a new issue if the bug still exists. The router is brand new. |
Any updates or workaround for this issue guys? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I have a problem with parenthesis characters:
this.router.navigate(['./Show', {id: "The Player (2015)"]);
---> works on first try
---> doesn't work on page refresh returns "The Player " (instead of "The Player (2015)")
And when I try to URI encode them:
this.router.navigate(['./Show', {id: encodeURIComponent("The Player (2015)")]);
---> doesn't works on first try (route params return "The%20Player%20")
---> doesn't work on page refresh returns "The%20Player%20" (instead of "The%20Player%20(2015)")
I guess that the problem is that the router will think that those parenthesis are auxiliary routes when you refresh the app. The router should probably encode those to something else and decode them for the params.
I'll make that myself for now, but it would probably be a good idea to have this implemented within the router himself for all "special" characters that it might use. I shouldn't be limited in any way regarding the characters that I put into the url.
The text was updated successfully, but these errors were encountered: