angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

$routeProvider - optional named group + trailing slash

Open jirikuchta opened this issue 12 years ago • 7 comments

From $routeProvider documentation:

If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition.

It seems this does not work as expected if there is an optional named group in route path definition (e.g. /page/:name?). In that case an encoded question mark will appear in the URL if you will navigate to /page/index/ (notice the trailing slash at the end).

You can test this issue in this plunkr.

jirikuchta avatar Oct 22 '14 11:10 jirikuchta

Seems to be the same issue as in https://github.com/angular/angular.js/pull/8200

But I'll keep it open in case the PR gets closed or anything.

Narretz avatar Oct 22 '14 12:10 Narretz

This has been fixed in 1.3.x. by #9827. Do we want to backport the fix to 1.2.x ?

gkalpak avatar Nov 23 '14 12:11 gkalpak

@gkalpak I think it makes sense to back-port it to 1.2.x. Would you be up to a PR?

pkozlowski-opensource avatar Nov 23 '14 13:11 pkozlowski-opensource

@pkozlowski-opensource: Working on it.

gkalpak avatar Nov 23 '14 14:11 gkalpak

awesome :+1:

pkozlowski-opensource avatar Nov 23 '14 14:11 pkozlowski-opensource

Backporting the fix to v1.2.x: #10202 /ping @pkozlowski-opensource

gkalpak avatar Nov 23 '14 16:11 gkalpak

Landed as 1b9e408ddbe48a6d3db27f501515d6efad01f42d, thnx!

pkozlowski-opensource avatar Nov 23 '14 18:11 pkozlowski-opensource