Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding many of the same views to Ember's ContainerView each with different model bindings
    primarykey
    data
    text
    <p>I have some views, well bound to their respective models:</p> <p>image.handlerbars:</p> <pre><code>URL:{{view Ember.TextField valueBinding="EvEditor.imageModel.imgUrl" }}&lt;br/&gt; </code></pre> <p>text.handlerbars:</p> <pre><code>{{view Ember.TextField valueBinding="EvEditor.titleModel.text" }}&lt;br/&gt; </code></pre> <p>I would now like to create a composite view that contains a number of images and text blocks:</p> <pre><code>var container = Ember.ContainerView.create({ childViews: ['firstView', 'secondView', 'thirdView', 'fourthView'], firstView: App.TextView, secondView: App.TextView, thirdView: App.ImageView, fourthView: App.ImageView }); </code></pre> <p>Now, as it stands, every ImageView and TextView will contain the same data, rather than having a different instance of the ImageModel / TextView assigned to each.</p> <p>What is the best way to architect this sort of thing ? I don't really want my code that creates the views to also have to know what properties need to be passed into each view, for instance, do I ?</p> <p>Ideally I'd write something like this pseudo-code:</p> <pre><code>var container = Ember.ContainerView.create({ childViews: ['firstView', 'secondView', 'thirdView', 'fourthView'], firstView: {view=App.TextView, model=App.EmberObjectincomingData[0]}, secondView: {view=App.TextView, model=App.EmberObjectincomingData[1]}, thirdView: {view=App.ImageView, model=App.EmberObjectincomingData[2]}, fourthView: {view=App.ImageView model=App.EmberObjectincomingData[3]}, }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload