this.
modalService.
open(
this.
chooseManagementDecisionOrOtherReasonModal,
{ backdrop:
'static', keyboard:
false}
).
result.
then((result)
=> {
console.
log(
result);
if (
result
===
'OK') {
}
}, (reason)
=> {
console.
log(
reason);
});
ngx-bootstrap的话是
- import { Component, TemplateRef } from '@angular/core';
- import { BsModalService } from 'ngx-bootstrap/modal';
- import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
- @Component({
- selector: 'demo-modal-service-options',
- templateUrl: './service-options.html'
- })
- export class DemoModalServiceOptionsComponent {
- modalRef: BsModalRef;
- config = {
- animated: true,
- keyboard: true,
- backdrop: true,
- ignoreBackdropClick: false
- };
- constructor(private modalService: BsModalService) {}
- openModal(template: TemplateRef<any>) {
- this.modalRef = this.modalService.show(template, this.config);
- }
- openModalWithClass(template: TemplateRef<any>) {
- this.modalRef = this.modalService.show(
- template,
- Object.assign({}, this.config, { class: 'gray modal-lg' })
- );
- }
- }