0

I'm new to meteor and coding in general. I need to change this to flow router so that I can get the comments to work(I guess). Does anyone want to lend a hand?

Router.map(function () {  
  this.route('post/:id', {
      waitOn: function() {
        return [
            Meteor.subscribe('post', this.params.id),
            Meteor.subscribe('postComments', this.params.id)
        ]
      },

      data: function() {
        return {
            post: Posts.findOne({_id: this.params.id}),
            comments: Comments.find({postId: this.params.id})
        }
      }
  });
});

And btw I'm using flow router on everything in the app so I guess iron conflicts with it which gives me this:

Oops, looks like there's no route on the client or the server for url: "http://localhost:3000/recipe-book." 
Masud Jahan
  • 3,418
  • 2
  • 22
  • 35
JEEBUS
  • 1
  • 3
  • According to the above code you're creating a route for `post/:id` but not for `recipe-book`. Also when using the Flow Router the name of the Router should be changed to FlowRouter unless you've defined Router to be equal to FlowRouter. – JKaan Nov 03 '16 at 11:43
  • Oh shit, that's true. So I changed the post/:id to 'recipe-book' and the error message is gone. But no comment section appeared though. I copied the code from this http://joshowens.me/adding-comments-to-your-meteor-js-app/ but I use the flowRouter in my app so I assume I need to change the ironRouting in his coding to flow to get the comments to work. Is this correct at all? – JEEBUS Nov 03 '16 at 12:04
  • Can you check if the comments variable is set? You're returning a variable called comments with some content so it should at least be set to something. – JKaan Nov 03 '16 at 19:30

0 Answers0