So I have a NgbModal
with a form in it, and what I want to achieve is closing it on successful submit.
This is my ModalComponent:
@Compo
This should work for you:
open(content) {
this.modalRef = this.modalService.open(content);
this.modalRef.result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
Otherwise your modalRef
variable will reference to ZoneAwarePromise
object