将meteor的铁路路由器parameter passing给模板callback
如何将铁路路由器parameter passing给Template.myTemplate.rendered
callback? 下面的路由和callback函数给两个console.log
都undefined
。
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 }
你有没有尝试过Router.current()。params?