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/", {id : studentId});
But this is not working. It does not redirect to edit page. Any idea about this?
Yo should use your Route name:
Router.go("students", {id:studentId});
Cheers
it throws me error as my router contains “add” Router.go("students/add/:id?", {});
It seems to that you dont have properly defined your Routes, with a name. For going to this route you should define it first in your router file.
For example, i’d call this route student.add so you it’s easier to understand later.
Router.route('/students/add/:id', {
name: "student.add",
action: function(){},
fastrender: true
})
// Then you can call it like I wrote before:
Router.go("student.add", {id:studentId});