- Notifications
You must be signed in to change notification settings - Fork27.4k
feat(routeProvider): Add support to catch-all parameters in routes#1560
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This allows routeProvider to accept parameters that matchessubstrings even when they contain slashes if they are prefixedwith an asterisk instead of a colon.For example, routes like edit/color/:color/largecode/*largecodewill match with something like thishttp://appdomain.com/edit/color/brown/largecode/code/with/slashs.
This PR is related to#1147 which was created by@andresmoschini and assigned to@mhevery. I've just added some tests and documentation. This is a simplified PR based on@pkozlowski-opensource comments in PR#1559. |
@lrlopez not the commit looks much better :-) |
Thanks :) This is my second PR, so I'm still learning. I'm not used to work in such a big project... |
dcu commentedNov 12, 2012
No, it isn't. But PR#1524 does, in fact. |
Enome commentedNov 16, 2012
This is really great for my app. No more ugly encoded paths in my urls! |
@pkozlowski-opensource, is there anything else I must do in order to have this PR integrated into the official codebase? |
georgiosd commentedJan 25, 2013
I think that the original code has changed in 1.0.4. Any chance to update the patch? (we manually patched 1.0.3 because we needed the catch-all and now cannot update) |
@georgiosd... let me have a look... |
I've updated the patch, you can pull it fromlrlopez@88bba84 It should be mergeable in 1.0.4 and 1.1.2 |
georgiosd commentedJan 25, 2013
Thanks! My JS regex skills are way below par Sent from a device with a small keyboard On 25 Jan 2013, at 22:49, "Luis Ramón López"notifications@github.com wrote:
|
georgiosd commentedFeb 11, 2013
I've found a bug, I think. I don't have time to jsfiddle it but it seems to work like this: consider two routes: This seems to cause an endless loop when the URL /search/location/foo is visited Note: (1) was left there by mistake and it's also a bug on our part. However, it should throw an exception or pick one of the two routes instead of the endless loop |
Hmmm... strange. Thanks for reporting the problem. I need to reproduce the problem before I dive into it, so it will take some time. |
georgiosd commentedFeb 12, 2013
No probs, let me know if u cant reproduce it with the example above and i ll see if i can create a test case Sent from a device with a small keyboard On 12 Feb 2013, at 23:58, "Luis Ramón López"notifications@github.com wrote:
|
MERGED |
This allows
routeProvider
to accept parameters that matches substrings even when they contain slashes if they are prefixed with an asterisk instead of a colon.This PR introduces a new syntax for route params, so we would have:
:param
for a single param*param
for catch-all paramsFor example, routes like
edit/color/:color/largecode/*largecode
will match with something like thishttp://appdomain.com/edit/color/brown/largecode/code/with/slashs
It also matches catch-all routes in the middle of the path.