I have a route / scoreboard / 1, where 1 is not a calm identifier of the object, but the identifier of the court, which I want to use to select the games where the court is.
I tried this code that establishes a session but does not load the template. Usually the template is loaded if I delete the event and the var code hard drive.
this.route('scoreboard',
{
path: '/scoreboard/:_id',
template: 'scoreboard',
onBeforeAction: function () {
Session.set('court', this.params._id);
}
});
I found this to work. What doesn't work is:
var court = Session.get("court");
console.log(court); -> 1
myGame = Games.findOne({court_id: court});
while it works:
myGame = Games.findOne({court_id: 1});
found him!
var court = parseInt(Session.get('court'));
source
share