Reputation: 4931
i have 2 routes trains, teams created with pods.
trains
--route.js
--template.hbs
teams
--route.js
--template.hbs
Router
Router.map(function() {
this.route('trains', function(){
this.route('teams', {path: '/:train_name'});
});
});
When i navigate to /trains/some-train-name/teams. it did not invoke teams route. it is looking for a template 'trains/teams'. is it expecting my teams folder to be inside trains folder. how to nest these 2 separate routes
Upvotes: 0
Views: 686
Reputation: 7159
trains
--route.js // common for all subroutes
--template.hbs // common for all subtemplates
index
--route.js
--template.hbs
teams
--route.js
--template.hbs
try next structure
If you still need to keep structure you show -- you need to update your Resolver
app/resolver.js
export default Ember.Resolver.extend({
resolve(fullName) {
// put custom logic here
}
});
I can't give you certain code, cause I need to debug to make it works Read more at http://emberjs.com/api/classes/Ember.DefaultResolver.html
P.S.
did you try ?
Router.map(function() {
this.route('trains');
this.route('teams', {path: 'trains/:train_name/teams'});
});
Upvotes: 1
Reputation: 6577
You have to reset the namespace so both routes are actually top-level, instead of teams
beings namespaced inside trains
. I do not recommend this, as it makes the structure confusing:
Router.map(function() {
this.route('trains', function(){
this.route('teams', { path: '/:train_name', resetNamespace: true });
});
});
Upvotes: 1