title: Bootstrap model do not closed properly when using with knockout js
body: <p>I am using knockout with bootstrap js. </p>
  
  <p>My requirement : </p>
  
  <ul>
  <li>I am creating an HTML form and I have done data binding using knockout.</li>
  <li>After submission of this form, I am showing a message to the user in bootstrap modal.</li>
  <li>On closing this modal I need to reset the HTML form. SO on clicking on the close button I and doing a click binding and calling a method. Below is the snippet of that method.</li>
  </ul>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// Re-setting the observable  to default value
  me.addStudentForClass(null);
  me.parents=ko.mapping.fromJS(new parentInfoModel(undefined));
  me.localGuardian=ko.mapping.fromJS(new localGuardian(undefined));
  me.lastSchoolEducation=ko.mapping.fromJS(new lastSchoolEducation(undefined));
  // Closing bootstrap Modal
  $('modal-id').modal('hide');
  // Cleaning the knockout node , to reflect the reset change 
  ko.cleanNode($('#add-student')[0]);
  // and binding the view model 
  ko.applyBindings(app.mainViewModel, $('#add-student')[0]);</code></pre>
  </div>
  </div>
  </p>
  
  <p>If we are not using below two lines of code then the modal work fine and modal got closed on clicking the close button </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>ko.cleanNode($('#add-student')[0]);
  ko.applyBindings(app.mainViewModel, $('#add-student')[0]);</code></pre>
  </div>
  </div>
  </p>
  
  <p>But I need to use the above two lines of code because it needs to reset my form.</p>
  
  <p>If we are delaying in cleaning the node then it works fine.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function saysomething(){
     ko.cleanNode($('#add-student')[0]);
     ko.applyBindings(app.mainViewModel, $('#add-student')[0]);
       }
       setTimeout(saysomething, 500); }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Please help me with this. I don't want to use setTimeout.And please suggest the best practice on this.</p>
  
  <p>Thank You</p>