Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Component, OnInit, EventEmitter, TemplateRef, ViewChild, Input, Output } from '@angular/core';
import {NgbModal, NgbModalRef, NgbActiveModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
import { ModalData } from '../../models/uiModels';
@Component({
selector: 'app-modal',
templateUrl : './modal.component.html',
styleUrls: ['./modal.component.css']
})
export class ModalComponent implements OnInit {
@ViewChild('dialog') private dialog: TemplateRef<any>;
@Input() message: ModalData;
@Output() actionHandler = new EventEmitter<string>();
modalRef: NgbModalRef;
constructor(private modalService: NgbModal) { }
openModal() {
// force button press to exit, no click-off.
const options: NgbModalOptions = {backdrop : 'static'};
this.modalRef = this.modalService.open(this.dialog, options);
}
closeModal(result) {
this.modalRef.close();
if (this.actionHandler) { this.actionHandler.emit(result); }
}
ngOnInit() {
// had to move opening the modal out of init and use settimeout to avoid this ...
// Error: ExpressionChangedAfterItHasBeenCheckedError ... bug in Angular
const that = this;
setTimeout(function() {that.openModal(); }, 10);
}
}