我正在使用ng-bootstrap为我的angular2项目打开一个模态.如果我点击外面和ESC按钮,模态会解散.我想限制这两种行为.下面是我打开模态的代码
import { NgbModal,NgbModalOptions } from '@ng-bootstrap/ng-bootstrap'; ..... modalOption: NgbModalOptions = null; constructor( private modalService: NgbModal,.... } .... //the method I am using to open a modal openAddModal() { this.modalOption.backdrop = 'static'; this.modalOption.keyboard = false; const modalRef = this.modalService.open(PremiumProtectionComponent,this.modalOption); ..... }
PremiumProtectionComponent是模态的ts文件.
< a(click)=“openAddModal()”>点击打开模态< / a>
任何人都可以建议我实现这种行为的正确方法.提前致谢