title: Buttons: Change value by ID in Ember.js
body: <p>I‘m trying to have a set of buttons in an <code>{{#each}}&lt;button&gt;...&lt;/button&gt;{{/each}}</code> block, and to get the target values by an ID of the model ...</p>
  
  <p>Let’s say there is a controller with model and action:</p>
  
  <pre><code>export default Ember.Component.extend({
  
      Texts: [
          {id: "1", name: "One", sample: "Hello!"},
          {id: "2", name: "Two", sample: "Hello! Hello!"},
          {id: "3", name: "Three", sample: "Hello! Hello! Hello! "},
      ],
  
      theText: "Test",
  
      actions: {
          setText: function(id) {
              var theText= this.get('Texts.sample', id);
              this.set('theText');
              console.log(theText);
          }
  
  });
  </code></pre>
  
  <p>and this in the template:</p>
  
  <pre><code>{{#each Texts as |Text|}}
      &lt;button {{action "setText" Text.id}}&gt;{{Text.name}}&lt;/button&gt;
  {{/each}}
  
  &lt;span&gt;{{theText}}&lt;/span&gt;
  </code></pre>
  
  <p>... this is my idea, but all I get is an <em>undefined</em> ...</p>