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

$routeParams get confused with some urls #1501

Closed
MTLoD opened this issue Oct 26, 2012 · 2 comments
Closed

$routeParams get confused with some urls #1501

MTLoD opened this issue Oct 26, 2012 · 2 comments

Comments

@MTLoD
Copy link

MTLoD commented Oct 26, 2012

I found a strange bug with $routeParams when using urls that include a part that named like a param that defined later on that url:

$routeProvider.when('/foo/:ID/:bar');

When using this, everything is fine. But if I change this definition to:

$routeProvider.when('/bar/:ID/:bar');

... then the values inside $routeParams.ID and $routeParams.bar get switched.

@pkozlowski-opensource
Copy link
Member

@Kokuswolf Good catch, definitively looks like a bug (!). Here is the reproduce scenario for 1.0.2: http://jsfiddle.net/NNVT5/6/

Tested with master as well and the bug is still there.

gonzaloruizdevilla added a commit to gonzaloruizdevilla/angular.js that referenced this issue Dec 11, 2012
Routes like '/bar/foovalue/barvalue' matching '/bar/:foo/:bar'
now are well mapped in $routeParams to:
{bar:'barvalue', foo:'foovalue'}

Closes: angular#1501
Signed-off-by: Gonzalo Ruiz de Villa <gonzaloruizdevilla@gmail.com>
gonzaloruizdevilla added a commit to gonzaloruizdevilla/angular.js that referenced this issue Dec 11, 2012
Routes like '/bar/foovalue/barvalue' matching '/bar/:foo/:bar'
now are well mapped in $routeParams to:
{bar:'barvalue', foo:'foovalue'}

Closes: angular#1501
Signed-off-by: Gonzalo Ruiz de Villa <gonzaloruizdevilla@gmail.com>
IgorMinar pushed a commit that referenced this issue Dec 14, 2012
Routes like '/bar/foovalue/barvalue' matching '/bar/:foo/:bar'
now are well mapped in $routeParams to:
{bar:'barvalue', foo:'foovalue'}

Closes: #1501
Signed-off-by: Gonzalo Ruiz de Villa <gonzaloruizdevilla@gmail.com>
IgorMinar pushed a commit that referenced this issue Dec 14, 2012
Routes like '/bar/foovalue/barvalue' matching '/bar/:foo/:bar'
now are well mapped in $routeParams to:
{bar:'barvalue', foo:'foovalue'}

Closes: #1501
Signed-off-by: Gonzalo Ruiz de Villa <gonzaloruizdevilla@gmail.com>
@pkozlowski-opensource
Copy link
Member

This was fixed in 30a9da5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants