dimanche 15 novembre 2015

How are ember links to reused nested routes defined using link-to?

Using the example route defined below how can a link be defined to /post/123/comments?

Router.map(function() {
  this.route('post', { path: '/post/:post_id' }, function() {
    this.route('edit');
    this.route('comments', { resetNamespace: true }, function() {
      this.route('new');
    });
  });
  this.route('comments');
});

Since resetNamespace: true is set on comments, the route post.comments does not exist. Otherwise the following would work.

{{#link-to "post.comments" "123"}}Link{{/link-to}}

When trying to link to news using the comment id, the error More context objects were passed than there are dynamic segments for the route: comments occurs.

{{#link-to "comments" "123"}}Link{{/link-to}}




Aucun commentaire:

Enregistrer un commentaire