对于我的铁:路由器,我有一个waitOn挂钩订阅的集合。每当我把钩上,页面无法加载从公用文件夹的图片和我不知道这是为什么.....waitOn钩:图片不加载
但每当我去掉勾WaitOn,图片加载一次。在路由器
认购
Router.route('/postPage/:_id', {
name: 'profile',
waitOn: function() {return Meteor.subscribe('comments', this.params._id) ;},
data: function() { return Posts.findOne(this.params._id); }
});
出版
Meteor.publish('comments', function(postId) {
check(postId, String);
return Comments.find({postId: postId});
});
检查(postid,字符串)是确保这一点。 params._id实际上是一个字符串?没有? –
对不起我本来应该更清晰 - 我的意思是你应该仔细检查你实际上是发送一个字符串 - 即确保'this.params._id'不是'undefined'。在终端或浏览器控制台中是否显示错误? –