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);
}
})
})
})
})
})
})
})
})
});