How do you send info from 2 different collections to one route in iron-router for meteor? -
how send info 2 different collections 1 route in iron-router meteor?
for example have posts , comments collection , wanted assign both posts.findone(this.params._id) , comments.find({postid: this.params._id}) data field of route detailedpost route display both post details , comments post.
you can assign them parameters of data object:
router.map(function() { this.route('detailedpost', { path: '/post/:id', data: function() { return { post: posts.findone(this.params._id), comments: comments.find({postid: this.params._id}), }; }, }); });
Comments
Post a Comment