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

Filter access the route params #90

Open
ciokan opened this issue May 31, 2013 · 3 comments
Open

Filter access the route params #90

ciokan opened this issue May 31, 2013 · 3 comments

Comments

@ciokan
Copy link

ciokan commented May 31, 2013

If I have a route defined that takes a url param say user_id and I have a filter set for all routes...how do I see inside my filter what the user_id contains? I should be able to know it's value since the filter is the same as after_render in rails.

Meteor.Router.add({
    '/:user_id': function (user_id) {
        return 'welcome';
    }
});

Meteor.Router.filters({
    'check_status': function (page) {
        // user_id??????????
        return page;
    }
});
@tmeasday
Copy link
Owner

tmeasday commented Jun 1, 2013

Take a look at this inside your filter function.

@tmeasday tmeasday closed this as completed Jun 1, 2013
@ciokan
Copy link
Author

ciokan commented Jun 1, 2013

Object {check_status: function}
check_status: function (page) {
arguments: null
caller: null
length: 1
name: ""
prototype: Object
constructor: function (page) {
arguments: null
caller: null
length: 1
name: ""
prototype: Object
__proto__: function Empty() {}
<function scope>
__proto__: Object
__defineGetter__: function __defineGetter__() { [native code] }
__defineSetter__: function __defineSetter__() { [native code] }
__lookupGetter__: function __lookupGetter__() { [native code] }
__lookupSetter__: function __lookupSetter__() { [native code] }
constructor: function Object() { [native code] }
hasOwnProperty: function hasOwnProperty() { [native code] }
isPrototypeOf: function isPrototypeOf() { [native code] }
propertyIsEnumerable: function propertyIsEnumerable() { [native code] }
toLocaleString: function toLocaleString() { [native code] }
toString: function toString() { [native code] }
valueOf: function valueOf() { [native code] }
__proto__: function Empty() {}
apply: function apply() { [native code] }
arguments: null
bind: function bind() { [native code] }
call: function call() { [native code] }
caller: null
constructor: function Function() { [native code] }
length: 0
name: "Empty"
toString: function toString() { [native code] }
__proto__: Object
<function scope>
<function scope>
__proto__: Object
__defineGetter__: function __defineGetter__() { [native code] }
__defineSetter__: function __defineSetter__() { [native code] }
__lookupGetter__: function __lookupGetter__() { [native code] }
__lookupSetter__: function __lookupSetter__() { [native code] }
constructor: function Object() { [native code] }
hasOwnProperty: function hasOwnProperty() { [native code] }
isPrototypeOf: function isPrototypeOf() { [native code] }
propertyIsEnumerable: function propertyIsEnumerable() { [native code] }
toLocaleString: function toLocaleString() { [native code] }
toString: function toString() { [native code] }
valueOf: function valueOf() { [native code] }

Sorry but I must be missing something. I can't seem to relate with the route param from inside this in my filter.

@tmeasday
Copy link
Owner

tmeasday commented Jun 1, 2013

Oh, apologies. I thought it was a context object, like inside a routing function. (this.params works there)

This will be address in an upcoming release.

@tmeasday tmeasday reopened this Jun 1, 2013
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

2 participants