I prefer to move as much logic as possible out of the view, and into to the view’s controller; thus making my views as dumb as possible.
To ensure my views stay dumb, I create a controller for each view. Instead of using {{view Ember.View}}
I use view/controller pairs by utilizing route.render()
or {{render}}
or {{control}}
. That way every view has a corresponding controller. (Unless I don’t need any logic such as Ember.TextField
which only does value binding).
I also try to make my controllers as thin as possible by moving events into the route. Unfortunately if a view does not represent a higher state (and thus no route exists for it), and might be re-used in any route, I either use App.ApplicationRoute
to handle its events, or handle its events in its controller.
I am interested to know if that is considered good practice.