3
votes

What I've got

ember-cli POD structure. I've got nested routes and so the following folder-structure:

|
|_pods
     |_items
          |_index
          |     |_controller.js
          |     |_route.js
          |     |_template.hbs
          |_item
                |_controller.js

I'm loading all the item-records of my model in the model-hook of items/index/route.js. In my index-template, I'm iterating over all items from the item model.

{{#each model as |item|}}
  ...
{{/each}}

That works fine. Now I want to call some properties from the alpha (singular) controller, so I added the itemController-Properties in the each-helper:

{{#each model itemController='items.item' as |item|}}

now I can access properties in my template for each item like {{item.myTestMethod}} which is defined in the alpha-controller.

What is the Problem?

But for some reason, other parts between the each-loop aren't accessible anymore (like {{item.title}} which is a model property). Also, the Ember-Inspector show me now two more entries in the "View Tree"-Tab, one for every item within the each-loop.

Can anybody explain me that?

1

1 Answers

3
votes

Controllers no longer proxy properties from the model. You need to fully qualify the property you want to access. The model is now the property model on the controller (which is what item is now).

Property on the model

{{item.model.title}}

Property on the controller

{{item.fooProp}}