Nyx*_*nyx 10 javascript node.js meteor
如何将Iron Router参数传递给Template.myTemplate.rendered
回调?以下路由和回调函数给出undefined
了两者console.log
.
网址
http://localhost:3000/story/1234
Run Code Online (Sandbox Code Playgroud)
Router.js
Router.map( function() {
this.route('story', {
path: '/story/:_id',
template: 'story'
})
})
Run Code Online (Sandbox Code Playgroud)
story.js
Template.story.rendered = function () {
console.log('params: ', this.params) // undefined
console.log('_id: ', this._id) // undefined
}
Run Code Online (Sandbox Code Playgroud)