0

我有以下路线:

@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. 

有谁知道发生了什么?

谢谢

4

1 回答 1

0

事实证明,您可以通过在嵌套中传递两个必需的模型来做到这一点:

#transition to first menu page
firstMenu = App.Menu.find().objectAt(0)
firstMenuPage = firstMenu.get('menu_pages').objectAt(0)
@transitionToRoute 'menu_page', firstMenu, firstMenuPage
于 2013-05-16T12:00:39.600 回答