How do you pass the Iron Router parameters to a Template.myTemplate.rendered
callback? The following route and callback function gives undefined
for both console.log
.
URL
http://localhost:3000/story/1234
Router.js
Router.map( function() {
this.route('story', {
path: '/story/:_id',
template: 'story'
})
})
story.js
Template.story.rendered = function () {
console.log('params: ', this.params) // undefined
console.log('_id: ', this._id) // undefined
}
Have you tried Router.current().params?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With