Event Generation and Event Handling Best Practices


#1

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)


#2

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.


#3

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.


#4

This should help add clarity: https://github.com/emberjs/ember.js/issues/3382