I am working on a sample app that will act as a journal. As such, I need to create dynamic routes.
My code in router.js looks like:
Router.route(':month/:day/:year', {
name: 'listView',
data: function () {
var month = this.params.month;
var day = this.params.day;
var year = this.params.year;
return Links.findOne({day: day, month: month, year: year});
}
My listView template is simple:
<template name="listView">
<li>{{title}} - {{url}} - {{comments}}</li></template>
Whenever I console.log any of the variables (day, month, year) I get back the expected values, but when they are put in the Links.findOne method, they don't seem to work (i.e. my data context does not get rendered in my template. If I hardcode the day, month and year in, the data context is properly passed to my template and it works.
Can someone help explain why variables will not work when hardcoded values do?