vendredi 3 juillet 2015

Nested routes in Ember.js

I have an ember app which requires the following views:


  • One to view all reviews that you've posted - /reviews
  • One to view a user's profile - /users/:id
  • One to view all reviews that another user has posted - /users/:id/reviews

I am struggling with the third one.

Here is my router.js

  this.route('reviews', function() {
    this.route('show', { path: "/:id" });
  });

  this.route('users', function(){
    this.route('show', {path: '/:id'}, function () {
      this.route("reviews", function(){});
    });
  });

My template for this route is in templates/users/show/reviews/index.hbs

And my route is in routes/users/show/reviews/index.js

But when I visit localhost:4200/users/1/reviews, it shows the user profile path (users/:id - the second bullet point). Like exactly the same

How do I get this route to work with the correct template and route.js file?




Aucun commentaire:

Enregistrer un commentaire