In the old V1 router, all controllers were injected into the router, so it was possible to do:
foo = App.get('router').get('applicationController').get('bar');
In the new V2 router, I can’t seem to even do:
router = App.get('router')
Has this changed?
Has the intended design pattern changed? Was I doing it wrong all along?
Today, you can get access to controllers from your routes (and route actions) via:
In your controllers, you declare dependencies on other controllers:
And then, inside your controller, you can also use
this.controllerFor.FYI, We plan to make this.get(‘controllers.posts’) work inside of controllers that use
needs, which would make using dependent controllers inside of your templates straight forward.