Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing params when using regexp route patterns #347

Open
lo1tuma opened this issue Mar 19, 2014 · 1 comment
Open

Confusing params when using regexp route patterns #347

lo1tuma opened this issue Mar 19, 2014 · 1 comment

Comments

@lo1tuma
Copy link
Member

lo1tuma commented Mar 19, 2014

If you are using a regexp route pattern, the match result gets merged into params which is very confusing in addition with query parameters.

Given the route pattern: /^(.*)$/i
The controller action would look like this:

// ...
action: function (params, callback) {
    var matchedRegexpPatternValue = params[0],
        otherQueryParam = params.otherQueryParams;
    // ...
}
// ...

You can see the confusing part is that an array gets merged into an object.

@bigethan
Copy link
Contributor

bigethan commented Apr 2, 2014

the regex stuff doesn't play nicely with normal use cases, but it is necessary. My thought for another option would be to add the array to the params as regexMatches and access to that instead of bundling them all into the object.

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

No branches or pull requests

2 participants