How can transitionToRoute
be called cleanly from within an Ember component?
It works with injecting a controller into the component and calling the cont
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 transitionToRoute
in a controller.