Angular4_Bootstrap 模态框避免点击背景处关闭(ng-bootstrap)

this. modalService. open(
this. chooseManagementDecisionOrOtherReasonModal,
{ backdrop: 'static', keyboard: false}
). result. then((result) => {
console. log( result);
if ( result === 'OK') {
}
}, (reason) => {
console. log( reason);
});


ngx-bootstrap的话是

  1. import { Component, TemplateRef } from '@angular/core';
  2. import { BsModalService } from 'ngx-bootstrap/modal';
  3. import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
  4.  
  5. @Component({
  6. selector: 'demo-modal-service-options',
  7. templateUrl: './service-options.html'
  8. })
  9. export class DemoModalServiceOptionsComponent {
  10. modalRef: BsModalRef;
  11. config = {
  12. animated: true,
  13. keyboard: true,
  14. backdrop: true,
  15. ignoreBackdropClick: false
  16. };
  17. constructor(private modalService: BsModalService) {}
  18.  
  19. openModal(template: TemplateRef<any>) {
  20. this.modalRef = this.modalService.show(template, this.config);
  21. }
  22.  
  23. openModalWithClass(template: TemplateRef<any>) {
  24. this.modalRef = this.modalService.show(
  25. template,
  26. Object.assign({}, this.config, { class: 'gray modal-lg' })
  27. );
  28. }
  29. }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值