2016-02-24 292 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 - 在我看來,它節省了一大堆時間,因爲它會在你輸入時爲你捕捉這樣的錯誤。 –