Events (evented) with before/after transitionTo


Hi all,

I use Ember.Evented to use the Ember event bus. Now we have the problem, that a published event is only available for initialized and rendered components.

const customers = this.get('customersService').findAll();
this.get('eventService').publish('', customers);

My related customer-list component will rendered on the target route customers but after initialize and rendering the component, the published event it is already ended. It’s possible to wait with the event trigger until the transitionTo is over?

This is my first try to fix my problem but unfortunatelly it doesn’t works because after the transition my component will not be rendered yet.

const customers = this.get('customersService').findAll();
this.get('router').transitionTo('customers').then(() => {;
    this.get('eventService').publish('', customers);

Hope for help or tipps.

Best regards, Mario


I think you should use service for that, that way you could easily save data and read it in component