If I have an application using the Router architecture, how do I get the controller of the parent route?
suppose a route like
Router: Ember.Router.extend
enableLogging: true
root: Ember.Route.extend
main: Ember.Route.extend
route: '/'
connectOutlets: (router, event) ->
router.get('applicationController').connectOutlet('main')
editor: Ember.Route.extend
route: '/editor'
connectOutlets: (router, event) ->
router.get('mainController').connectOutlet('editor')
So how would my EditorController get a hold of my MainController?
I’ve tried @get('parentController'), @get('parent'), and @get('controller') with no success
You can access the router through the
targetproperty of a controller.e.g, in your case, from any controller:
Or, if you do not use head revision of Ember: