javascript - Meteor this.params._id is undefined based upon ":_id?" -
i have game know works id per code on client side. example if use below {{game._id}} works properly:
template.gamepage.game = function() { return gamecollection.findone({current: true}); };
however, trying gain access publications of 'submissions; specific game id. console log below returns undefined.
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) ]; } });
i suspect params._id pulls games/:_id, however, that remains games/:_id? not have unnecessary long address.
any thoughts on why getting undefined params._id
i think have 1 button access game, example...
tracker.autorun(function () { session.set('gamecurrent'); }); template.gamepage.helpers({ allgames: function(){ return gamecollection.find({}); }, getcurrentgame:function(){ return session.get('gamecurrent'); } }) // action access route id specified template.gamepage.events({ 'click button#game' : function(event,template){ session.set('gamecurrent',this._id); router.go('editemail',{_id:this._id}) } })
remember session works in client.
Comments
Post a Comment