title: Meteor: render template inside a template on click
body: <p>I have a Meteor app that has a template loaded.
  Inside that template I have a button.
  When the button is clicked, I want the app to render or switch to another template which also happens to be a modal.</p>
  
  <p>I can't figure out how to render another template from the click event function.</p>
  
  <p>Any ideas? Here is my code below.</p>
  
  <p><strong>search.html</strong></p>
  
  <pre><code>&lt;template name='search'&gt;
  
      &lt;button class='btn btn-primary' id='showModalButton'&gt;Show Modal&lt;/button&gt;
  
  &lt;/template&gt;
  
  &lt;template name='searchCustomer'&gt;
  
      &lt;!-- set up the modal to start hidden and fade in and out --&gt;
      &lt;div id="myModal" class="modal fade"&gt;
        &lt;div class="modal-dialog"&gt;
          &lt;div class="modal-content"&gt;
          &lt;div class="modal-header"&gt;
            &lt;h4 class="modal-title"&gt;Modal title&lt;/h4&gt;
          &lt;/div&gt;
            &lt;!-- dialog body --&gt;
            &lt;div class="modal-body"&gt;
                My modal body
            &lt;div class="modal-footer"&gt;&lt;button type="button" class="btn btn-primary"&gt;OK&lt;/button&gt;&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/template&gt;
  </code></pre>
  
  <p><strong>search.js</strong></p>
  
  <pre><code>Template.search.onRendered(function() {
      'click #showModalButton': {
         // WHAT DO I DO HERE TO RENDER OR CALL THE 
         // SEARCHCUSTOMER TEMPLATE WITH THE MODAL?
      }
  
  });
  
  Template.searchCustomer.onRendered(function() {
  
      $("#myModal").on("show", function() {    
            $("#myModal a.btn").on("click", function(e) {
                $("#myModal").modal('hide');
            });
        });
  
        $("#myModal").on("hide", function() {    
            $("#myModal a.btn").off("click");
        });
  
        $("#myModal").on("hidden", function() {  
            $("#myModal").remove();
        });
  
        $("#myModal").modal({                    
          "backdrop"  : "static",
          "keyboard"  : true,
          "show"      : true   // show the modal immediately                  
        });
  
  });
  </code></pre>