waitOn hook on Iron router for Subsciption: Images not loading


#1

For my iron:router, I have a waitOn hook for subscription to a Comments collection. Whenever I switch the hook on, the page can’t load the pictures from Public folder and I am not sure why that is…

But whenever I remove the WaitOn hook, the picture loads again.

Subscription at Router

Router.route('/postPage/:_id', {
  name: 'profile',
  waitOn: function() {return Meteor.subscribe('comments', this.params._id) ;},
  data: function() { return Posts.findOne(this.params._id); }
});

Publication

Meteor.publish('comments', function(postId) {
  check(postId, String);
  return Comments.find({postId: postId});
});

#2

Could you check your url for the images?

I had this exact same problem on my first day with meteor.

on “/” my images worked, on “/dashboard” they worked on “/posts/:_id” they did not.

The reason:

my images were relative “images/blah.jpg” they needed to be absolute “/images/blah.jpg”