【发布时间】:2015-10-09 22:46:38
【问题描述】:
其他人在stackoverflow上发布了类似的问题,但还没有答案......
我的第一个动态路线有效。我在第一个动态路由内有一个嵌套动态路由,但该嵌套路由的模板从不显示。
这条路线有效(显示 post.hbs):
#/home/post/29
但是对于这条路线:
#/home/post/29/comment/123
我希望会显示comment.hbs,但仍会显示post.hbs。
我的路由器长这样:
this.route('home', { path: '/home'}, function() {
this.route('post', {path: "/post/:post_id"}, function() {
this.route('comment', {path: "/comment/:comment_id"}, function() {
....
在我的 post.hbs 中有这个:
<div {{action 'doNavigateToComment' comment}}>
在我的 route\home\post.js 我有:
doNavigateToComment(comment_id) {
this.transitionTo('home.post.comment', this.get('postId'), comment_id);
}
我的文件结构如下:
\routes
home.js
\home
post.js
\post
comment.js
\templates
\home
index.hbs
post.hbs
post\
comment.hbs
在控制台中打开了跟踪,但没有显示错误。
我正在使用 ember 1.13.5(其行为类似于 ember 2.0)
【问题讨论】:
标签: ember.js ember-router