Reputation: 365
For my iron:router, I have a waitOn hook for subscription to a collection. Whenever I put 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});
});
Upvotes: 0
Views: 49
Reputation: 188
try data: function() { return Posts.findOne(_id: this.params._id); }
Upvotes: 0
Reputation: 64332
One reason it could fail to load is that the waitOn
is never returning. waitOn
will block until all its subscriptions are all marked as ready by their respective publishers. In this case, the comments
publisher would fail if postId
isn't a string - an error will be thrown and this.ready()
will never be called. I'd recommend debugging further by:
this.params._id
is actually a stringcheck(postId, String)
from the publisherUpvotes: 1