title: knockout replace the binded model
body: <p>I have a modal dialog to add new models and after a successful ajax submit I want to be able to type in a new model. So my logic was like this:</p>
  
  <p>Button for new model -> set the editViewModel to a new model instance -> submit button -> after successful submit set the editviewModel to a new model</p>
  
  <pre><code>function model() {
      this.name = ko.observable("");
  }
  
  var myViewModel = new model();
  myViewModel.name("Name 1");
  ko.applyBindings(myViewModel, document.getElementById('foo'));
  
  function newViewModel() {
      myViewModel = new model();
      myViewModel.name("NewName");
      //ko.applyBindings(myViewModel, document.getElementById('foo'));
  }​
  </code></pre>
  
  <p>fiddle: <a href="http://jsfiddle.net/56gkz/" rel="nofollow">http://jsfiddle.net/56gkz/</a></p>
  
  <p>To get that working I have to re-apply the binding after changing the editViewModel to the new model instance.
  So is it the right way to apply the binding again or is there a better solution to handle that case?</p>