title: Implementing a Menu in Knockout - switching between views with different viewModels
body: <p>Essentially I am trying to implement RobN's extremely simple template switcher <a href="http://jsfiddle.net/rniemeyer/XYz8M/" rel="nofollow">http://jsfiddle.net/rniemeyer/XYz8M/</a> which uses 'template' data binding.</p>
  
  <pre><code>   (---SO wants code here - see fiddle for complete code---)
     &lt;div id="templateContent" data-bind='template: { name: currentView() }'&gt;&lt;/div&gt;
  
     var viewModel = {
        currentView: ko.observable("template-1"),
        toggleView: function() {
         this.currentView(this.currentView() === "template-1" ? "template-2" : "template-1");   
       }
    };
  
    ko.applyBindings(viewModel);
  </code></pre>
  
  <p>I have seen a lot of other simple examples doing this and all are using the same viewModel class for each loaded template.  Exception - RobN's SamplePresentation app (I don't have enough rep points to post another link) while very impressive I found hard to connect to my noobie KO experience.  I think he is doing this in his section.activate() method, but, it's unclear to me.</p>
  
  <p>I want to use this concept in a real app, but having binding context issues.  Here is what I am trying to do: <a href="http://jsfiddle.net/jockor/DSEDh/4/" rel="nofollow">http://jsfiddle.net/jockor/DSEDh/4/</a></p>
  
  <pre><code>   This line intentionally left blank (please see fiddle vs. mangling code here)
  </code></pre>
  
  <p>Basically when a nav link/button is pressed I simply want to swap out the body content panel with another template.  That template will need its own data backed by its own viewModel. </p>
  
  <p>The fiddle above is my go at a simplified version of this concept - just trying to switch between the Cats and Dogs panels.  What I encounter is that the data bound to the 'template' data-bind is used for the loaded cat/dog templates.  </p>
  
  <p>Can someone tell me if I am doing this correctly, or if I am abusing the 'template' binding concept?</p>