我有以下路线:
@resource 'menus', (->
@resource 'menu', {path: ':menu_id'}, ( ->
@resource 'menu_pages', ( ->
@resource 'menu_page', {path: ':menu_page_id'}
)
)
)
我试图按如下方式转换到嵌套路线:
firstMenuPage = App.MenuPage.find(1)
@transitionToRoute 'menu_page', firstMenuPage
但是我收到以下错误:
Uncaught Error: assertion failed: Cannot call get with 'id' on an undefined object.
任何人都知道发生了什么事?
感谢
答案 0 :(得分:0)
事实证明,你可以通过在嵌套中传递两个必需的模型来实现它:
#transition to first menu page
firstMenu = App.Menu.find().objectAt(0)
firstMenuPage = firstMenu.get('menu_pages').objectAt(0)
@transitionToRoute 'menu_page', firstMenu, firstMenuPage