Created
May 29, 2020 02:32
-
-
Save mehulkar/1874384e0f618db42ca88b580eda057f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationRoute extends Route { | |
myAction() { | |
// do some fancy stuff here | |
} | |
setupController(controller, model) { | |
super.setupController(controller, model); | |
// Instead of setting on the controller, you can also inject | |
// a service into this route and set the action there. | |
controller.set('someProperty', this.myAction); | |
} | |
} | |
// then in application.hbs | |
// <MyComponent @arg1={{this.someProperty}} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just for link an official doc with the use of setupController:
https://guides.emberjs.com/release/routing/asynchronous-routing/