Zach Smith
Zach Smith

Reputation: 8961

How to pass variables to FlowRouter 'named routes'?

I have the following route:

FlowRouter.route('/users/:_id/edit', {
    name: 'Users.edit',
    action() {
        BlazeLayout.render('App_body', { main: 'Users_edit_page' });
    },
});

And I can access the appropriate page with the following code:

var userId = Meteor.userId();
FlowRouter.go('/users/' + userId + '/edit');

How do you pass the userId through to Users.edit name, instead of using the URI path.

Incidentally, I read somewhere that FlowRouter doesn't have named routes - is this not a named route?

Upvotes: 1

Views: 1080

Answers (1)

aedm
aedm

Reputation: 6584

FlowRouter.go('Users.edit', {id: 1});

See here: https://github.com/kadirahq/flow-router#api

Upvotes: 4

Related Questions