title: Binding to an array or object subscript
body: <p>I'm wanting to do something that I suspect is quite easy but for some reason can't figure out how to get my head around it:</p>
  
  <pre><code>{{#each item in myArray}}
      {{ui-input value=storeMe[@index]}}
  {{/each}}
  </code></pre>
  
  <p>In the above case I'd be iterating through a numeric array of things and I want to store values of a UI component using the same numeric index. </p>
  
  <p>Similarly it would be nice to be able to do the following:</p>
  
  <pre><code>{{#each item in myArrayOfObjects}}
      {{ui-input value=storeMe[item.id]}}
  {{/each}}
  </code></pre>
  
  <p>Where the storage device -- <code>storeMe</code> -- is a dictionary whose keys are determined by the <code>id</code> property of each item in array of objects. </p>
  
  <hr>
  
  <p>In my particular use-case, I am asking the user to input a strategy for measuring body fat. I use a select box for that:</p>
  
  <pre><code>&lt;div class="clearfix downer"&gt;
      {{x-selectize 
          options=measurementStrategies 
          labelField="name" 
          placeholder="measurement strategy" 
          valueObject=measurementPoints 
      }}
  &lt;/div&gt;
  </code></pre>
  
  <p>By binding to the "valueObject" above I get back a simple array of measurement points which are relevant for the user chosen strategy (e.g., chest, thigh, lower back, etc.). I then iterate through these measurement points and want to have a value stored for each one:</p>
  
  <pre><code>&lt;div class="downer"&gt;
      {{#each point in measurementPoints}}
          &lt;div class="clearfix"&gt;
              {{ui-number-input value=model.measurements[point]}}
          &lt;/div&gt;
      {{/each}}
  </code></pre>
  
  <p>This doesn't work, of course, because apparently I can't bind to an offset property (aka, <code>measurements[point]</code>). </p>
  
  <p>In many cases this type of problem doesn't matter because if I want to manipulate the structure I'm iterating over then the <em>each</em> loop provides the indirection. The problem comes when the storage property is hanging off of a different base than that which you are iterating over. So in my case, if I were actually manipulating <code>point</code> or a property hanging off of <code>point</code> this would be easy because <code>point</code> <strong>is</strong> an offset of <code>measurementPoints</code> but in my case I'm iterating <code>measurementPoints</code> and saving values to <code>model.measurements</code>.</p>