Event Generation and Event Handling Best Practices

Any good documentation how to design generation and handling of events in Ember 1.x and 2.0.

I do see patterns of

component → controller → route
component → route
component → controller
component → route → controller

not sure which one is right and why it is right

in the bulbing scenario, which one get the first chance, it is application level of specific route level (which I see it as first chance given to route actions)

The concept you’re referring to is called “action”. Terminology is important because there are other things in Ember that’s called events.

component --> route --> controller is invalid case. You should never send actions from route to controller.

Actions bubble from controller to it’s route then to the route’s parent route. Actions always bubbles up.

1 Like

I was referring to events handling flow when they are generated using

this.sendAction(‘action’, id) or this.send(action’, id)

Not sure how these two calls differ too.

This should help add clarity: `send` and `sendAction` API · Issue #3382 · emberjs/ember.js · GitHub

1 Like