0
我有一个游戏,我知道在客户端每个代码的ID都能正常工作。例如,如果我是使用下面的与{{game._id}}它正常工作:流星this.params._id未定义基于“:_id?”
Template.gamePage.game = function() {
return GameCollection.findOne({current: true});
};
不过,我想访问的“提交的出版物;仅限特定的游戏ID。下面的控制台日志返回未定义。
router.js
this.route('gamePage', {
path: '/games/:_id?',
waitOn: function() {
console.log(this.params._id);
return [
Meteor.subscribe('randomQuestions', Random.id()),
Meteor.subscribe('submissions', this.params._id)
];
}
});
我怀疑params._id从游戏拉/:_ ID,但是,我想它,使之保持游戏/:_ ID?所以我没有不必要的长地址。
为什么我收到未定义params._id任何想法
当你得到this.params._id时,你指向的URL是什么?undefined? “我怀疑params._id从游戏/:_ id”拉到了“的确如此。 – saimeunt 2014-09-10 16:25:21