1
我有一个嵌套的路由结构,允许分页/排序/搜索,将以某种方式基本上调整ArrayController。我在当前实现中遇到的问题是,需要一切来获取有效页面进行渲染。如何使用不需要所有参数的ember.js构建嵌套路由?
http://localhost:8000/#/page/1/sort/username/search/dave
如果我只能通过网页出现错误
Uncaught Error: assertion failed: Could not find state for path
我缺少嵌套路线的东西还是需要标记排序/搜索可选一些如何?
PersonApp.Router = Ember.Router.create({
root: Ember.Route.extend({
index: Ember.Route.extend({
route: '/',
connectOutlets: function(router) {
router.get('applicationController').connectOutlet('person', router.get('store').findAll(PersonApp.Person));
},
paginated: Ember.Route.extend({
route: '/page',
index: Ember.Route.extend({
route: '/:page_id',
connectOutlets: function(router, context) {
console.log("here with page id " + context.page_id);
router.get('personController').set('selectedPage', context.page_id);
},
exit: function(router) {
router.get('personController').set('selectedPage', undefined);
},
sorted: Ember.Route.extend({
route: '/sort',
index: Ember.Route.extend({
route: '/:column',
connectOutlets: function(router, context) {
console.log("SORTING " + context.column);
},
search: Ember.Route.extend({
route: '/search',
index: Ember.Route.extend({
route: '/:term',
connectOutlets: function(router, context) {
console.log("SEARCHING " + context.term);
}
})
})
})
})
})
})
})
})
});