Ember-cli-routing-service
Transition routes anywhere with no magic.
Usage
ember install ember-cli-routing-service
Once installed, in your application
route:
;
And now you are ready to transition routes in components:
// some component Component;
The transitionTo
method on the routing service has the exact same signature as
you would find in normal routes.
How It Works
Super simple and a bit hacky. We create a service called routing
that mixes in
Ember.Evented
. When you call transitionTo
, we simply trigger an event on the
service and forwards all the arguments to the listener.
The TransitionToListenerRoute
simply sets up a listener for the event on init
.
Embed rather than Inherit
If for any reason you don't want to directly inherit from the TransitionToListenerRoute
,
you can also do the following:
// in app/routes/application.js ;; Route;
Running Tests
ember test