tmeasday / meteor-router

MIT License
366 stars 76 forks source link

filters and routenames #72

Closed joernroeder closed 11 years ago

joernroeder commented 11 years ago

I went into trouble when I tried to add filters to routes with optional parameters. Therefore I declared the names for my routes but it seems like the filter isn't checking the right name. Maybe I'm doing something wrong?

a quick example:

Meteor.Router.add
    '/':
        as: 'homeTest'
        to: 'home'

    '/create/:step?': 
        as: 'create'
        to: (step) ->
            …

Meteor.Router.filter 'checkLoggedIn', 
    only: 'create'

# I have to change 'homeTest' to 'home' to run the filter on the home page
Meteor.Router.filter 'checkLoggedIn', 
    only: 'homeTest' 
tmeasday commented 11 years ago

Hi @joernroeder

Sorry for the late reply. I think the problem could be that filters apply to template names not route names.