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

Getting params as one object not on callback arguments #154

Open
andreujuanc opened this issue Nov 20, 2016 · 1 comment
Open

Getting params as one object not on callback arguments #154

andreujuanc opened this issue Nov 20, 2016 · 1 comment

Comments

@andreujuanc
Copy link

Hello!

As title says, is there a way to get the callback parameters as one object, instead of separated function arguments?

What we have now:
myRouteCallback(id, name)

What I was thinking it would help me a lot:
myRouteCallback(param) { param.id .. param.name..

Cheers

@andreujuanc
Copy link
Author

Just did it myself, subscribing to routed.add and:

   var processRequest = function(params){ 
        var request = {
        };

        params.route._paramsIds.forEach(function(paramId, index) {
            request[paramId] = params.params[index];
        }, this);

        return request;
    };

But there is a problem, im using _paramsIds , and it's suposed to be private. is this the only way to do it?

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

No branches or pull requests

1 participant