Angular: 模态 window 在外部点击时消失
Angular: modal window disappears when clicking outside
我的联系表单以模式打开
export class ContactFormComponent implements OnInit {
constructor(public activeModal: NgbActiveModal, private contactService: ContactService) { }
close() {this.activeModal.dismiss('Cross click');}
}
我从这里调用它
export class AppComponent implements OnInit {
constructor(private modalService: NgbModal) { }
ngOnInit() { }
openContactForm() {
this.modalService.open(ContactFormComponent, { windowClass: 'contact-modal', size: 'xl' });
}
}
在我的 app.component.html
<div class="col-12 text text-center" style="cursor:pointer;" (click)="openContactForm()">Contact Us</div>
在联系表单区域外单击会隐藏它 - 我在哪里以及如何将它设置为静态,以便只能通过关闭或发送按钮将其关闭?
尝试将 backdrop
属性 设置为 'static'
https://ng-bootstrap.github.io/#/components/modal/api#NgbModal
我的联系表单以模式打开
export class ContactFormComponent implements OnInit {
constructor(public activeModal: NgbActiveModal, private contactService: ContactService) { }
close() {this.activeModal.dismiss('Cross click');}
}
我从这里调用它
export class AppComponent implements OnInit {
constructor(private modalService: NgbModal) { }
ngOnInit() { }
openContactForm() {
this.modalService.open(ContactFormComponent, { windowClass: 'contact-modal', size: 'xl' });
}
}
在我的 app.component.html
<div class="col-12 text text-center" style="cursor:pointer;" (click)="openContactForm()">Contact Us</div>
在联系表单区域外单击会隐藏它 - 我在哪里以及如何将它设置为静态,以便只能通过关闭或发送按钮将其关闭?
尝试将 backdrop
属性 设置为 'static'
https://ng-bootstrap.github.io/#/components/modal/api#NgbModal