Routing as a service?


I am implementing some relatively complicated modal components. One of the things I’d like to do is depending on the state of the modal, have the url transition (and hence the background UI transition). Currently I am putting all my “transition needs” into an “Evented” service, and have application route monitor the service. Whenever application route observes a “transition” event fired from the service, it will do the transition. The user level api looks like the following

export default Ember.Component.extend({
  routing: Ember.inject.service(),

  someFunc(model) {
    this.get('routing').transitionTo('blog', model);

It would be awesome if this is built into Ember, especially considering we are about to remove controllers. Once controller is removed, the only thing that can transition is Route, which is not very accessible from components or services.

What do you guys think?


Btw, I made this into an addon. You can try it out:


also there is a private routing service in ember

routing: Ember.inject.service('-routing')


Super awesome! Wonder how much more of Ember’s awesomeness is buried in the RFC.