import { Component, TemplateRef } from '@angular/core'; import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; @Component({ selector: 'demo-modal-service-disable-esc-closing', templateUrl: './disable-esc-closing.html' }) export class DemoModalServiceDisableEscClosingComponent { modalRef: BsModalRef; config = { keyboard: true }; constructor(private modalService: BsModalService) {} openModal(template: TemplateRef) { this.modalRef = this.modalService.show(template, this.config); } }