Quantcast
Viewing all articles
Browse latest Browse all 4826

What's the proper way to route from components?

@alidcastano wrote:

Inside a component, this.transitionTo or this.TransitionToRoute do not work.

My current work around is to inject the router service, for example:

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

      actions: {
        submit: function() {
          this.get('router').transitionTo('home');
        }
      }
    });

Is this bad practice? Is there a better way to handle routing from components (that does not include controllers)?

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles