You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And when I programmatically $router.navigate(['foo', { baz: '1/2/3' }]) the wildcard portion of the url only shows the first part (in this case: /1)
What I believe that's happening is that the PathRecognizer isn't capturing the full wildcard and that the bug is in path_recognizer.ts in the recognize method
So, after having slept about this I don't really see, why we are building the url from the catpured array at all ... I think it would be best to not use the captured array at all:
diff --git a/modules/angular2/src/router/path_recognizer.ts b/modules/angular2/src/router/path_recognizer.ts
index 263ae94..788843f 100644
--- a/modules/angular2/src/router/path_recognizer.ts+++ b/modules/angular2/src/router/path_recognizer.ts@@ -197,7 +197,6 @@ export class PathRecognizer {
var nextSegment = beginningSegment;
var currentSegment: Url;
var positionalParams = {};
- var captured = [];
for (var i = 0; i < this._segments.length; i += 1) {
var segment = this._segments[i];
@@ -208,8 +207,6 @@ export class PathRecognizer {
}
if (isPresent(currentSegment)) {
- captured.push(currentSegment.path);-
// the star segment consumes all of the remaining URL, including matrix params
if (segment instanceof StarSegment) {
positionalParams[segment.name] = currentSegment.toString();
@@ -233,7 +230,7 @@ export class PathRecognizer {
return null;
}
- var urlPath = captured.join('/');+ var urlPath = beginningSegment.toString();
var auxiliary;
var urlParams;
Activity
zoechi commentedon Jan 6, 2016
Did you try a string instead of a number? There was a bug report recently that a number is misinterpreted. Might not be related though.
ethanve commentedon Jan 6, 2016
Just tried it without numbers and it still causes the same issue.
davidreher commentedon Jan 12, 2016
I am having the same issue here 👍 :/
davidreher commentedon Jan 12, 2016
The problem is, that the
urlPathis constructed from thecapturedelements. In thesegment instanceof StarSegmentbranch we are breaking the loop, socaptureddoes not contain all the necessary parts (only the first part of the StarSegment).What we did for now is the following:
If this is really a bug and not working as expected, I can work on a pull request ...
davidreher commentedon Jan 13, 2016
So, after having slept about this I don't really see, why we are building the url from the
catpuredarray at all ... I think it would be best to not use thecapturedarray at all:davidreher commentedon Jan 13, 2016
@btford what do you think? Is there any reason why the
urlPathis built the way it is now?ethanve commentedon Jan 14, 2016
It does seem like there is no need for it
davidreher commentedon Jan 18, 2016
Of course there is a need for it, but I think most of the Google guys are just busy atm ...
waeljammal commentedon Jan 29, 2016
+1 having this issue as well.
vicb commentedon Sep 26, 2016
obsolete - former router
angular-automatic-lock-bot commentedon Sep 9, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.