[英]Meteor dynamic url explicit template finding path instead
I have a dynamic iron route with the template explicitly set, however iron router attempts to render the path instead of the template. 我有一个动态设置了模板的动态铁路线,但是铁路由器试图渲染路径而不是模板。
http://localhost:3000/blog/example-post http:// localhost:3000 / blog / example-post
Couldn't find a template named "Blog:permalink" or "blog:permalink". 找不到名为“博客:永久链接”或“博客:永久链接”的模板。 Are you sure you defined it? 确定要定义吗?
Router.route('/blog/:permalink'), {
template: 'blogPost',
name: 'blogPost',
path: '/blog/:permalink',
data: function () {
return Blogs.findOne({ permalink: this.params.permalink, published: true });
}
}
Router.route('blog'), {
path: '/blog',
waitOn: function () {
return [
Meteor.subscribe('blogs')
]
}
}
You closed route )
without adding there the options object ( see ,
after )
). 您关闭路线)
而无需添加有选项的对象(见,
后)
)。 That's why iron:router
tries to generate template name from path: 这就是为什么iron:router
尝试从路径生成模板名称的原因:
Router.route('/blog/:permalink'), {
Should be: 应该:
Router.route('/blog/:permalink', {
template: 'blogPost',
name: 'blogPost',
path: '/blog/:permalink',
data: function () {
return Blogs.findOne({ permalink: this.params.permalink, published: true });
}
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.