2012-08-03 44 views

回答

0

This seems to work just fine

總體的路由似乎真的複雜到我,可能做錯事。也許你正在嘗試做更復雜的事情,而我的簡化又破壞了它?

posts: Em.Route.extend({ 
     route: '/posts', 
     gotoPost: Em.Route.transitionTo('post'), 

     connectOutlets: function(router) { 
      router.get('applicationController').connectOutlet('posts', App.Post.find()); 
     }, 

     post: Em.Route.extend({ 
      route: '/posts/:post_id', 
      gotoComments: Em.Route.transitionTo('post.comments'), 

      connectOutlets: function(router, post) { 
       router.get('applicationController').connectOutlet('post', post); 
      }, 

      comments: Em.Route.extend({ 
       route: '/posts/:post_id/comments', 
       connectOutlets: function(router, post) { 
        router.get('applicationController').connectOutlet('comments', post); 
       }, 

      }), 
     }) 
    }), 
+0

如果我錯了,請糾正我,但我的印象是,只有葉子路線應該是可導航的,而且這些路線是相對的。 (你的小提琴似乎沒有與代碼同步嗎?jsfiddle與我發送的是一樣的,我相信,並且在日誌中出現「Uncaught RangeError:Maximum call stack size exceeded」。) – dechov 2012-08-03 19:28:31

+0

我想我應該按下'更新'按鈕: - /一秒... – radixhound 2012-08-03 20:05:56

+0

@pauldechov修復鏈接 – radixhound 2012-08-03 20:10:10