I'm launching a modal using ngx-bootstrap
via this.modalService.show(ListModalComponent, <options>)
by passing in the component to the modal (docs link). I need to subscribe to an event emitter in the component to act on change events from inside the modal but I am unable to get a reference to the component because it doesn't exist before the modal is shown. What is the recommended approach?
Here's a Plunkr with my current setup. Please see app.component.ts
line 17.
You can subscribe to this event after calling .show()
like this this.bsModalRef.content.listUpdates.subscribe({...})
Also, you can create a shared service and inject it in both components, and use this event instead of an internal event of modal.