對於我的鐵:路由器,我有一個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'。在終端或瀏覽器控制檯中是否顯示錯誤? –