Skip to content Skip to sidebar Skip to footer

Cannot Close Ng-bootstrap Modal

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: @Component({ selector: 'create-update-transact

Solution 1:

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


Post a Comment for "Cannot Close Ng-bootstrap Modal"