2016-02-24 296 views
0

如果我访问/ whatever /:_ id/result页面,除静态文本外,没有任何东西会被渲染。为什么要我的流星签名工作?有什么我在这里失踪?Meteor.subscribe does not work

Router.route('/whatever/:_id/result', { 
    template: 'result', 
    name: 'result', 
    data: function(){ 
     var currentId = this.params._id; 
     console.log(currentId); 
     return Questions.findOne({_id:currentId}); 
    }, 
    WaitOn: function(){ 
     var currentId = this.params._id; 
     return [ Meteor.subscribe('arguments', currentId), Meteor.subscribe('questions',currentId) ] 
    }, 
    onBeforeAction: function(){ 
     this.next(); 
    } 
}); 

我的服务器上Ive得到:

Meteor.publish('arguments', function(currentId){ 
    return Arguments.find({decisionId:currentId}); 
}); 

Meteor.publish('questions', function(currentId){ 
    return Questions.find({_id:currentId}); 
}); 

回答

1

我认为这是一个简单的拼写错误。

WaitOn: ... 

应该

waitOn: ... 

用小写字母W上。

+0

哇这些错别字..现在它的工作 – decisionMaker

+0

你应该使用ESLint - 在我看来,它节省了一大堆时间,因为它会在你输入时为你捕捉这样的错误。 –