title: Set the return value of Meteor JS Helper, inject this dynamically into template
body: <p><strong>EDIT:</strong>  </p>
  
  <p>Given the answers below, using <a href="http://manual.meteor.com/#deps" rel="nofollow">Meteor Deps</a> seems like the ideal play since I want to share data between two distinct templates, and it should be reactive to any changes that occur.  </p>
  
  <p>To clarify: source of my data is <code>Template.reactiveTable</code> and the destination is <code>Template.buttons</code>.  When the data in <code>reactiveTable</code> changes, I want the buttons to reflect this.  </p>
  
  <p><strong>END EDIT</strong></p>
  
  <p>I am looking to set the value of <code>buttons</code> based on the content of a table (specifically, the <code>&lt;h1&gt;</code> values).</p>
  
  <p>buttons.html: </p>
  
  <pre><code>  &lt;template name="buttons"&gt;
      {{#each testButtons }}
         &lt;button id="{{ name }}"&gt;{{ name }}&lt;/button&gt;
      {{/each}}
    &lt;/template&gt;
  </code></pre>
  
  <p>With this hard-coded it works as expected (two buttons render labeled Alice and Bob</p>
  
  <pre><code>UI.registerHelper('testButtons', function () {
          return [ 
            { name: "Alice" }, 
            { name: "Bob" } 
          ]
      }
  )
  </code></pre>
  
  <p>The template happily accepts and renders this <strong>array of objects</strong>. However, NOT when I generate the array of objects dynamically.  </p>
  
  <p><strong>Goal:</strong> for each unique word contained within my h1 tags, generate a button (almost like a blog tags).</p>
  
  <p>By replacing my helper code with snippet below (using jquery parsing <code>&lt;h1&gt;</code> tags, generate array to send to template).</p>
  
  <p>Assume html is: </p>
  
  <pre><code>  &lt;h1&gt;foo&lt;/h1&gt;
    &lt;h1&gt;bar&lt;/h1&gt;
    &lt;h1&gt;baz&lt;/h1&gt;
  </code></pre>
  
  <p>then run snippet below in console, will create <code>uniqStrings = [ "foo", "bar", "baz"];</code> as desired.</p>
  
  <pre><code>$( 'h1' ).map(function () {
    var words = [];
    words.push($(this).text());
    uniqStrings = _.uniq(words);
  
  });
  </code></pre>
  
  <p>How do I then send <code>uniqStrings</code> back to my buttons template to render <code>n= uniqStrings.length</code> buttons?  Thanks!</p>