Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
/angular.jsPublic archive

feat(routeProvider): Add support to catch-all parameters in routes#1560

Closed
lrlopez wants to merge1 commit intoangular:masterfromlrlopez:catchall-params-2

Conversation

lrlopez
Copy link
Contributor

This allowsrouteProvider 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 params

For example, routes likeedit/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.

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.
@lrlopez
Copy link
ContributorAuthor

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.

@pkozlowski-opensource
Copy link
Member

@lrlopez not the commit looks much better :-)

@lrlopez
Copy link
ContributorAuthor

Thanks :) This is my second PR, so I'm still learning. I'm not used to work in such a big project...

@dcu
Copy link

dcu commentedNov 12, 2012

@lrlopez do you think this is related to#1193 ?

@lrlopez
Copy link
ContributorAuthor

No, it isn't. But PR#1524 does, in fact.

@Enome
Copy link

This is really great for my app. No more ugly encoded paths in my urls!

@lrlopez
Copy link
ContributorAuthor

@pkozlowski-opensource, is there anything else I must do in order to have this PR integrated into the official codebase?

@georgiosd
Copy link

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)

@lrlopezlrlopez mentioned this pull requestJan 25, 2013
4 tasks
@lrlopez
Copy link
ContributorAuthor

@georgiosd... let me have a look...

@lrlopez
Copy link
ContributorAuthor

I've updated the patch, you can pull it fromlrlopez@88bba84

It should be mergeable in 1.0.4 and 1.1.2

@georgiosd
Copy link

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:

I've updated the patch, you can pull it fromlrlopez/angular.js@88bba84

It should be mergable in 1.0.4 and 1.1.2


Reply to this email directly or view it on GitHub.

@georgiosd
Copy link

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:
(1) /search/location/:id
(2) /search/*query

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

@lrlopez
Copy link
ContributorAuthor

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
Copy link

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:

Hmmm... strange. Thanks for reporting the problem. I need to reproduce the problem before I dive into it, so it will take some time.


Reply to this email directly or view it on GitHub.

@mhevery
Copy link
Contributor

MERGED

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@lrlopez@pkozlowski-opensource@dcu@Enome@georgiosd@mhevery

[8]ページ先頭

©2009-2025 Movatter.jp