title: Closing a modal when click on the form submit
body: <p>My modal holds a form and I want to close the modal when the user clicks the submit button. The simplified form looks like this:</p>
  
  <pre><code>&lt;div class='modal fade' id='{{ module.name }}Modal' role='dialog'&gt;
  &lt;div class='modal-dialog modal-lg'&gt;
      &lt;div class='modal-content'&gt;
          &lt;form ng-submit='submitModule(module)'&gt;
              &lt;div class='modal-body'&gt;
                  ...
              &lt;/div&gt;
              &lt;div class='modal-footer'&gt;
                  &lt;button type='submit' class='btn btn-primary'&gt;Run&lt;/button&gt;
                  &lt;button type='button' class='btn btn-default' data-dismiss='modal'&gt;Cancel&lt;/button&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>You can see the two buttons. The close button uses <code>data-dismiss='modal'</code> which works fine. But I can't use that on the submit button, because that "cancels" out the <code>ng-submit=submitModule()</code> submission function; the modal will close but the function won't get called.</p>
  
  <p>Would the solution be to close the modal from the <code>submitModule()</code> function? But how can I get a hold of the modal from there?</p>