Cannot close ng-bootstrap Modal

前端 未结 1 470
渐次进展
渐次进展 2021-01-13 02:31

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         


        
相关标签:
1条回答
  • 2021-01-13 03:33

    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

    0 讨论(0)
提交回复
热议问题