有两条路由 ( comments
, )trackbacks
嵌套在post
我直接通过content
. 不幸的是,控制器似乎没有完全初始化并且内容没有被加载。commentsController
trackbacksController
/posts/1/trackbacks
这是看起来的Router
样子:
Router = Ember.Router.create
root: Ember.Route.extend
index: Ember.Route.extend
route: '/'
post: Ember.Route.extend
route: '/posts/:post_id'
index: Ember.Route.extend
route: '/'
redirectsTo: 'comments'
comments: Ember.Route.extend
route: '/comments'
connectOutlets: (router) ->
controller = router.get('postController')
controller.connectOutlet 'comments', controller.get('comments')
trackbacks: Ember.Route.extend
route: '/trackbacks'
connectOutlets: (router) ->
controller = router.get('postController')
controller.connectOutlet 'trackbacks', controller.get('trackbacks')
这是TrackbacksController
:
App.TrackbacksController = App.ArrayController.extend
init: ->
console.log App.router.get('attributesController.content') # : []
@_super()
是否有router.commentsController
手动初始化以从中获取内容的最佳实践trackbacksController
?我的方法有什么问题吗?