Hitesh S
Hitesh S

Reputation: 580

Router.go() does not working when adding extra path

I have created Router in my router.js like this :

Router.go("students/add/:id?", {
    name:"students",
    progress: {
        enabled: false
    },
    fastRender: true
});

In My add new student page i have this code in my submit event to redirect on edit mode page

Router.go("students/add/" + studentId);

But this is not working. It does not redirect to edit page. Any idea about this?

Upvotes: 0

Views: 50

Answers (2)

Pankaj Jatav
Pankaj Jatav

Reputation: 2184

The good way to write your router.go in Iron router is:

Router.go('post.show', {_id: 1}, {query: 'q=s', hash: 'hashFrag'});

So your Router.go will be like

Router.go('students', {id?:studentId});

Upvotes: 1

pahan
pahan

Reputation: 2453

it should be Router.go("/students/add/" + studentId); (with slash)

Upvotes: 1

Related Questions