I am trying to define a nested resource in an ember application suite. Is my file structure incorrect? When I add a nested resource, I get the following exception:
Error: Assertion Failed: The URL '/pages.index' did not match any routes in your application
Just commenting on the function that defines the embedded resource of the "page", the application loads correctly and displays the page template.
Router Code:
var Router = Ember.Router.extend();
Router.map(function() {
this.route('component-test');
this.route('helper-test');
this.resource('pages', {path: '/pages'}
, function() { this.resource('page', {path: ':page_id'}); }
);
});
export default Router;
The file structure is as follows:
$ ls -R
component-test.js helper-test.js pages
component_test.js index.js pages.js
./pages:
index.js page.js
Page Route:
export default Ember.Route.extend({
model: function() {
return [{title: "One", _id: "one"}, {title: "Two", _id: "two"}];
}
});
pages / index route:
export default Ember.Route.extend({
model: function() {
return this.modelFor('page');
}
});
The generated es6 module for the pages / index route is as follows:
define("appkit/routes/pages/index",
["exports"],
function(__exports__) {
"use strict";
__exports__["default"] = Ember.Route.extend({
model: function() {
return this.modelFor('page');
}
});
});
source
share