Reputation: 138
I show a product on the website, just like this: /#/products/1
. The user can open a page at the same time, this page will be on top of the show product. Just like an overlay, a little smaller as the product page. So that you can see a little bit of the product behind it.
I think the url should be: /#/products/1/page/1
. So the user can share the link of the opened page with the product.
The result is this router:
Router.map(function() {
this.resource(products, function() {
this.resource(product, function(path: ':product_id') {
this.resource('page', function(path: ':page_id'));
});
});
});
Is this good Ember practice? Or should it be done another way?
Thanks for sharing any thoughts.
Upvotes: 2
Views: 158
Reputation: 47367
Totally fine, your doing it a bit wrong, but nested resources is the way to go
Router.map(function() {
this.resource('products', function() {
this.resource('product', {path: ':product_id'}, function() {
this.resource('page', {path: 'page/:page_id'}, function());
});
});
});
Upvotes: 2