Hey there,
just look at this code - maybe you can explain why things work or not.
The short version is this:
Running Router.current().params
logs an empty array []
to the console, while running Router.current().params._id
logs the correct id. I just don’t think this is even possible Strange.
Here are some more examples, all of these functions are template helpers:
// 1. Doesn't work
pdf: function () {
var params = Router.current().params;
// Console Output:
// []
console.log(params);
}
// 2. Works
pdf: function () {
var id = Router.current().params._id;
var n = Router.current().params.n;
// Console Output:
// C5hshvNHhddjhnvWq 0
console.log(params, n);
}
// 3. Doesn't work
pdf: function () {
var id = Router.current().params._id;
var n = Router.current().params.n;
var pdf = PDFs.findOne({
patientId: id,
quote: n
});
// Console Output:
// undefined
console.log(pdf)
}
// 4. Works
pdf: function () {
// Values come from example 2
var pdf = PDFs.findOne({
patientId: 'C5hshvNHhddjhnvWq',
quote: 0
});
// Console Output
// > Object
console.log(pdf);
}
This just doesn’t seem to make any sense. I basically want to get example 3 running, and I’ve never had such a problem before (or didn’t notice). Any idea why this might happen?