EventEmitter from bootstrap modal component to parent EventEmitter from bootstrap modal component to parent angular angular

EventEmitter from bootstrap modal component to parent


It is actually very simple as you can directly subscribe to the @Output events of the component opened as modal's content:

export class NgbdModalComponent {  constructor(private modalService: NgbModal) {}  open() {    const modalRef = this.modalService.open(NgbdModalContent);    modalRef.componentInstance.name = 'World';    modalRef.componentInstance.clickevent.subscribe(($e) => {      console.log($e);    })  }}

Here is a working plunker: http://plnkr.co/edit/rMJ7qfSSLK0oHspIJbDB?p=preview

Side note: I'm not sure what is your exact use case but the answer to Event emitter from bootstrap modal to parent shows preferred method of communication between modal opener and a component used as a modal's content.