Я пытаюсь определить вложенный ресурс в наборе приложений ember. Неверна ли моя файловая структура? Когда я добавить вложенный ресурс, я получаю следующее исключение:Набор приложений и маршруты ресурсов Ember
Error: Assertion Failed: The URL '/pages.index' did not match any routes in your application
Простым комментированием функцию определения вложенного «страницы» ресурс, приложение загружает правильно и отображает шаблон страницы. Код
Маршрутизатор:
var Router = Ember.Router.extend();
Router.map(function() {
this.route('component-test');
this.route('helper-test');
this.resource('pages', {path: '/pages'}
// if this line is commented out, no error (index route is not called though)
, function() { this.resource('page', {path: ':page_id'}); }
);
});
export default Router;
структура файла таким образом:
$ ls -R
component-test.js helper-test.js pages
component_test.js index.js pages.js
./pages:
index.js page.js
Страницы маршрута:
export default Ember.Route.extend({
model: function() {
return [{title: "One", _id: "one"}, {title: "Two", _id: "two"}];
//this.store.find('page');
}
});
страницы/индекс маршрута:
export default Ember.Route.extend({
model: function() {
return this.modelFor('page');
}
});
ES6 порожденный модуль для маршрута страницы/индекса выглядит следующим образом:
define("appkit/routes/pages/index",
["exports"],
function(__exports__) {
"use strict";
__exports__["default"] = Ember.Route.extend({
model: function() {
return this.modelFor('page');
}
});
});
Каково было ваше решение? –