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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -