title: How to validate and close bootstrap 3 modal form in Angular 5?
body: <p>I have few text inputs which I need to validate in a bootstrap 3 modal form and I am using Angular 5. I want to close the modal form only if all validations are successful. It should remain as it is if validations fail, on click of a button. </p>
  
  <p>Plnkr:
  <a href="https://plnkr.co/edit/VgLArC3RkKMgXOhAPGei?p=preview" rel="nofollow noreferrer">https://plnkr.co/edit/VgLArC3RkKMgXOhAPGei?p=preview</a></p>
  
  <pre><code>&lt;!-- Trigger the modal with a button --&gt;
  &lt;button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal"&gt;Open Modal&lt;/button&gt;
  
  &lt;!-- Modal --&gt;
  &lt;div id="myModal" class="modal fade" role="dialog"&gt;
    &lt;div class="modal-dialog"&gt;
  
      &lt;!-- Modal content--&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title"&gt;Modal Header&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;p&gt;On click of validate, this modal form should not get closed if text input is empty. It should get closed only if text input is not empty.&lt;/p&gt;
          &lt;input type="text"&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Validate&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to know how can we avoid closing of modal form from Angular using typescript. Appreciate your help.</p>