Reputation: 28587
Where should the template files be placed for nested routes when using the pod structure in ember-cli?
Here is what I have at the moment.
/foo
works
app/foo/template.hbs
gets rendered./foo/bar
does not work, I get "Error: Assertion Failed: The URL '/foo/aa' did not match any routes in your application"
app/foo/bar/template.hbs
gets rendered.Router:
Router.map(function() {
this.resource('foo', function() {
this.resource('foo.bar', function() {
});
));
/* ... */
});
Folder Structure:
/app/pods
/foo
controller.js
route.js
template.hbs
/bar
controller.js
route.js
template.hbs
Should I be defining my routes differently or naming my files differently?
Upvotes: 2
Views: 843
Reputation: 4854
In the documentation page, it says "app/templates/ Your Handlebars templates. These are compiled to templates.js. The templates are named the same as their filename, minus the extension (i.e. templates/foo/bar.hbs -> foo/bar)."
Actual result: "Error: Assertion Failed: The URL '/foo/aa' did not match any routes in your application"
It is searching for /foo/bar/bar.hbs , however your case is /foo/bar/template.hbs
Naming convention is the key role of ember.js.
Route
Router.map(function() {
this.resource('foo', function() {
this.resource('bar', function() { // 'bar' route nested in 'foo' route
});
});
});
Upvotes: 1