繁体   English   中英

Angular中的Bootstrap模态关闭事件

[英]Bootstrap modal close event in Angular

如何在Angular 7中处理Bootstrap Modal

我在Bootstrap Modal中有要在模式关闭事件中重置的表单(当在模式外部关闭时单击),我在Google上进行了搜索,但找不到任何内容

任何帮助将非常感激

如果您使用@ ng-bootstrap ,则可以这样

首先,我有这样的子组件。 该组件将是一个弹出窗口

export class DeleteInvoiceComponent implements OnInit {
  public confirmState = ConfirmState;
  constructor(public activeModal: NgbActiveModal) {}

  public ngOnInit(): void {}
}

并认为

(click)="activeModal.close(confirmState.Ok)"

所以在我的父组件中

import { NgbModal } from "@ng-bootstrap/ng-bootstrap";

 constructor(
    private modalService: NgbModal
  ) {}

public deleteInvoice(invoiceId: string): void {
    this.modalService.open(DeleteInvoiceComponent).result.then(result => {
      if (result === ConfirmState.Ok) {
        do some thing
      }
    });
  }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM