How do I transition to a route pragmatically from inside a component action?
I tried to use @get(\'controller\').transitionToRoute(\'images\'
I've written this answer for another similar question.
If you want to use the router only in a specific component or service or controller, you may try this:
Initialize an attribute with the private service -routing. The - because it's not a public API yet.
router: service('-routing'),And then inside any action method or other function inside the service or component:
this.get('router').transitionTo(routeName, optionalParams);Note: It'll be
transitionToRoutein a controller.
Link to question: Ember transitionToRoute cleanly in a component without sendAction
Link to answer: https://stackoverflow.com/a/41972854/2968465