jeudi 8 octobre 2015

ember 2.0 nested dynamic templates renders the wrong template

Others have posted similar problems on stackoverflow, but no answers yet...

My first dynamic route works. I have a nested dynamic route inside the first dynamic route, but the template of that nested route is never displayed.

This route works (the post.hbs is displayed):

#/home/post/29

But for this route:

#/home/post/29/comment/123

I expect the comment.hbs to display, but the post.hbs is still displayed.

My router looks like:

this.route('home', { path: '/home'}, function() {
    this.route('post', {path: "/post/:post_id"}, function() {
        this.route('comment', {path: "/comment/:comment_id"}, function() {
        ....

In my post.hbs I have this:

<div {{action 'doNavigateToComment' comment}}>

In my route\home\post.js I have:

doNavigateToComment(comment_id) {
  this.transitionTo('home.post.comment', this.get('postId'), comment_id);
}

My filestructure looks like this:

\routes
  home.js
  \home
    post.js
    \post
      comment.js
\templates
  \home
    index.hbs
    post.hbs
    post\
      comment.hbs

Tracing is turned on in the console, but it shows no error.

I am using ember 1.13.5 (which shall behave like ember 2.0)

Aucun commentaire:

Enregistrer un commentaire