We use one of the later versions of Ember (Router V2), and not to the edge of the bloodstream with the newer Router V2.2 (Last commit: 668783a (2013-01-06 21:10:55 -0800))
In our solution, we have several View components (Grid, autocomplete, search, etc.). Some of these components refer to the store, models, etc. Therefore, they have a controller that handles this work. These views are used in several templates in our solution.
In the old version (pre2), we used components like this:
App.ConsoleView = Ember.View.extend({ templateName: 'console', searchView: App.SearchView.extend(), ..... })
And in the console template, we used a general view like this
{{view view.searchView controllerBinding='App.searchController'}}
I always felt that this approach is not the best way, and with the new version of Ember it hit us on the fingers :)
Now to the question: "What is the recommended way to use the general view in a template that needs a controller."
In newer versions of Ember, the expression pattern
{{view view.searchView controllerBinding='App.searchController'}}
does not work because App.searchController is no longer created in the application namespace.
I thought about some options, but I really don't like them.
- I could connect the controller to the "parent controller" through the router, but then I would have to do this on every route where I use a common component, and that will be a lot.
- I could get the controller through the hacker way and install it through the init function in the init function.
Does anyone have any recommendations on how to do this? I can not find the documentation on this issue and finished googlejuize.
All reviews will be appreciated!