Today I have come to a shocking discovery: actions referenced on a view are handled by their route, not by the view which referenced it. Ex:
<a href="#" {{action edit}}>Edit this</a>
The edit action must be defined in the Route, not in the View. When I was not using a Router before the View was the one responsible for handling such events and I was really happy about it.
Can anyone please:
- explain to me why the Route must handle the event, and what are the benefits of this
- tell me how can I give control back to the View in matters of handling such actions/events?
Set the target as view
If your action is in controller then use
Default target refers to the view’s controller
I’d suggest you to go through this Reference: Ember Action Helper
I’d like to mention some key points as per the above reference