Here’s a JS Fiddle of what I’m talking about.
I am rendering three Item
s on screen via the {{render}}
helper, each of which shows the Item
’s Subitem
s. (I can’t just use outlets, as multiple expanded items must be visible at the same time).
Subitems
is properly initialized with their own unique instances of the SubitemsController
. However, in the subitems
template and controller, the controllers.item
references whatever Item
was opened last.
This is bad, because if I were to put a Create Subitem form inside of the subitems
template and associate it as a child of the Item
, it will associate the new Subitem
with the most recently opened Item
, instead of the Item
the form is actually in.
How can I work around this and ensure I can access the proper Item
from the SubitemsController
and/or subitems
template? Or, what is the “Ember Way” to render multiple instances of a controller on screen simultaneously?