I think I have a problem understanding how the data loaded by controller should be binded and become available to the view. For the purpose of this question I have crafted a small example in jsFiddle that uses ember-rest to load data.
As you can see in the jsFiddle, what I want to achieve in this example is to bind my testData to BlockView which is rendered using the blocki template. What is an appropriate way to do this in Ember?
To get an idea of what the fiddle would look like when it is running properly replace the binding to blocksController to directly bind to the testData. I have done this in another version of the jsFiddle.
{{view App.BlockView blockiBinding="App.testData" }}
Of course the blocks render properly in this version — but that is not how I want to do this. I want to learn how to properly (as recommended by Ember) connect the blockController to the view and get the data from it. In a real scenario the data will be obtained from a REST API and that is why I am using ember-rest in this example.
If you fix that jsFiddle with your ninja moves, please take a few seconds and explain the concept behind how it works. I found it very difficult to obtain up to date information about this. Thanks!
You connect a view with a controller by using
a) The appropriate naming scheme
b) connect the outlets
For example if you have a view BlockView you should have a controller BlockController. Then from the view you can access the content of the controller directly.
What I also miss in your code example is the router. This one takes care of the appropriate ‘glueing’ of all the components. Take a look at the router in Trek’s tutorial (which is btw up to date and represents the way how an application should be written).
In the router you will define the connectOutlets method in which you load the view that should be rendered into the outlet. And if you stick with the naming scheme from above, you have direct access from your view to the controller
Update
I got your code running with some modifications:
Unfortunately I am not able to create a jsFiddle (don’t ask why – no clue :)). So I have added the data to a GIST – https://gist.github.com/3832764.
Update 2
And I also managed to create now a JSFiddle http://jsfiddle.net/qV5wu/2/ 🙂