@maffews wrote:
I've tried searching for an answer to this question but I'm not even sure what terms to search for, so I haven't had much luck.
I would like to share templates between different parent routes
The simple case: nested routes. I want administration routes to share a base template and I want all user-administration templates to share a base template as well. I can do that very easily with the routing below:
this.route('admin', { path: '/admin' }, function () { this.route('user', { path: '/user/:user_id' }, function () { this.route('billing', { path: '/billing' }); this.route('subscriptions', { path: '/subscriptions' }); }); this.route('other', { path: '/other' }); });
- /admin/user/:id/billing and /admin/user/:id/subscriptions share both a parent and grandparent template
- /admin/user/:id (index) and /admin/other share a parent template
The user templates are searched for in templates/admin/user/billing.hbs and templates/admin/user/subscriptions.hbs. These templates are shims that load the user-billing and user-subscriptions components.
The problem: I'd like to share the billing and subscriptions templates under /admin/user/:id with the templates a user would see at /billing and /subscriptions. Something along these lines:
this.route('user', { path: '' }, function () { this.route('billing', { path: '/billing' }); this.route('subscriptions', { path: '/subscriptions' }); });
This would work (maybe path needs to be changed to '/') but it would look for templates in templates/user/billing.hbs and templates/user/subscriptions.hbs. Because these templates are shims that load the user-billing and user-subscriptions components, it's not a lot of overhead to maintain, but I'm wondering if there's a better solution.
Posts: 1
Participants: 1