Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(ngRoute): wrong redirect to paths containing optional or special parameters #5746

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ngRoute/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,10 @@ function $RouteProvider(){
if (i === 0) {
result.push(segment);
} else {
var segmentMatch = segment.match(/(\w+)(.*)/);
var segmentMatch = segment.match(/(\w+)([\?|\*])?(.*)/);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need the pipe in the square brackets

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was a third special operator because it was used in the function pathRegExp, the part of code you have just updated with the #5920
I'll remove it as soon as I'll be at my pc.

var key = segmentMatch[1];
result.push(params[key]);
result.push(segmentMatch[2] || '');
result.push(segmentMatch[3] || '');
delete params[key];
}
});
Expand Down