title: How to listen the close event of a modal in ngBootstrap and Angular?
body: <p>I'm trying to subscribe to the close event of a modal using ngbootstra, but I don't understand how it works. I have 2 components The 1st for lauching the modal and inside the 2nd one.</p>
  <p><strong>the 1st</strong></p>
  <p><strong>html</strong></p>
  <pre><code>&lt;button class=&quot;btn btn-lg btn-outline-primary&quot; (click)=&quot;open()&quot;&gt;Launch demo modal&lt;/button&gt;
  </code></pre>
  <p><strong>TS</strong></p>
  <pre><code>import { OtherComponent } from './../other/other.component';
  import { Component, OnInit } from '@angular/core';
  import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
  import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap/modal/modal.module';
  
  @Component({
    selector: 'app-joker',
    templateUrl: './joker.component.html',
    styleUrls: ['./joker.component.scss']
  })
  export class JokerComponent {
    constructor(private modalService: NgbModal, private activeModal: NgbActiveModal) { }
  
    open(): void{ 
      const modalRef = this.modalService.open(OtherComponent, {centered: true});
      modalRef.componentInstance.name = 'Gerardo';
    }
  }
  </code></pre>
  <p><strong>The 2nd</strong></p>
  <p><strong>html</strong></p>
  <pre><code>&lt;div class=&quot;modal-header&quot;&gt;
    &lt;h4 class=&quot;modal-title&quot;&gt;Hi there!&lt;/h4&gt;
    &lt;button type=&quot;button&quot; class=&quot;close&quot; aria-label=&quot;Close&quot; (click)=&quot;activeModal.dismiss('Cross click')&quot;&gt;
      &lt;span aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/span&gt;
    &lt;/button&gt;
  &lt;/div&gt;
  &lt;div class=&quot;modal-body&quot;&gt;
    &lt;p&gt;Hello, {{name}}!&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;modal-footer&quot;&gt;
    &lt;button type=&quot;button&quot; class=&quot;btn btn-outline-dark&quot; (click)=&quot;activeModal.close('Close click')&quot;&gt;Close&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  <p><strong>TS</strong></p>
  <pre><code>import { Component, Input} from '@angular/core';
  import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
  
  @Component({
    selector: 'app-other',
    templateUrl: './other.component.html',
    styleUrls: ['./other.component.scss']
  })
  export class OtherComponent {
  
    @Input() name: any;
    constructor(public activeModal: NgbActiveModal) { }
    
  
  }
  </code></pre>
  <p>But I don't know hoy to do the subscribe because it says that the close method is not an observable, also I like know how to emit any value when the modal is close in the 2nd component (2nd) Does some know how to do it?.</p>
  <p>Btw is it necessary to do a unsubscribe?</p>