I am trying to make in response to an event, the Telescope go to post next/previous.
var y = Router.current().data().postedAt;
var nex = Posts.find({postedAt:{$gt:y}}, {sort: {postedAt:1}, limit:1});
nex.forEach(function(nex){ vai = nex._id;});
Router.go('post_page', vai, {_id:vai});
The problem is when I try to pass the nex._id
to the router. It appears this message on the console:
Error: Missing required parameters on path "/ posts /: _ id". The missing params are: ["_id"]. The params object passed in was: "erhqpuXxXgk9EA4Gg".
The _id
is passed properly, but is not recognized. Thanks!
I could make it work. See how was:
var y = Router.current().data().postedAt;
var nex = Posts.find({postedAt:{$gt:y}}, {sort: {postedAt: 1}, limit:1} );
nex.forEach(function(nex){ _id = nex._id;});
Router.go('post_page', {_id:this._id});