Angular 2 ng-bootstrap close Modal

前端 未结 3 912
无人及你
无人及你 2020-12-09 17:50

I am trying to close the modal that was presented to me through the open(content) function as shown in the example in the Documentation of ng-boostrap. In the website, it me

3条回答
  •  独厮守ぢ
    2020-12-09 18:40

    I followed the doc from ng-bootstrap with Angular 6. Finally I found the solution changing one line from the original example:

    modal-options.html

    
      
      
      
    
    

    I changed from this let-modal to this let-d="dismiss" and also this 2 lines:

    • (click)="d('Cross click')"
    • (click)="d('Close click')"

    modal-options.ts

    constructor(private modalService: NgbModal) {}
    
    openLg(content) {
      this.modalService.open(content, { size: 'lg' });
    }
    

提交回复
热议问题