title: Angular NgbModal beforeDismiss not working
body: <p>I would like to add a class to the pop up modal before it is closed and then wait for a while before closing it. Looking at the documentation it looks like I can archive this with <code>beforeDismiss</code> in the <code>NgbModalOptions</code> options; <a href="https://ng-bootstrap.github.io/#/components/modal/examples" rel="nofollow noreferrer">https://ng-bootstrap.github.io/#/components/modal/examples</a></p>
  
  <p>But it does not work. Here is my open method;</p>
  
  <pre><code>  open(content) {
      const options : NgbModalOptions = {
        size: 'lg',
        windowClass: 'animated bounceInUp',
        beforeDismiss: () =&gt; {
          setTimeout(()=&gt;{
            alert ('Hello!');
          },2000);
          return false;
        }
      };
      this.modalRef = this.modalService.open(content, options).result.then((result) =&gt; {
        //this.closeResult = `Closed with: ${result}`;
      }, (reason) =&gt; {
        //this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
      });
      console.log (this.modalRef);
    }
  </code></pre>
  
  <p>I don't mind closing it from outside if that is possible. For example something like <code>this.modalRef.close</code> but this shows an error modalRef.close is not a function.</p>
  
  <h2>Update</h2>
  
  <p>This is my HTML;</p>
  
  <pre><code>&lt;ng-template #content let-c="close" let-d="dismiss"&gt;
    &lt;div class="modal-header"&gt;
      &lt;h4 class="modal-title"&gt;Save As Site Product Settings&lt;/h4&gt;
      &lt;button type="button" class="close" aria-label="Close" (click)="d('Cross click')"&gt;
        &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
      &lt;/button&gt;
    &lt;/div&gt;
    &lt;div class="modal-body"&gt;
      {{product.title}}
    &lt;/div&gt;
    &lt;div class="modal-footer"&gt;
      &lt;button type="button" class="btn btn-primary" (click)="saveProductAs()"&gt;Save As Site Product&lt;/button&gt;
      &lt;button type="button" class="btn btn-outline-dark" (click)="c('Close click')"&gt;Close&lt;/button&gt;
    &lt;/div&gt;
  &lt;/ng-template&gt;
  </code></pre>
  
  <p>I have discovered that it does not work on just this <code>&lt;button type="button" class="btn btn-outline-dark" (click)="c('Close click')"&gt;Close&lt;/button&gt;</code> But works on the cross icon. How do I get it to work on <code>c('Close click')</code>?</p>