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,
Input,
Output,
EventEmitter,
ViewChild,
ElementRef,
OnChanges,
SimpleChanges
} from '@angular/core';
import { NgForm } from '@angular/forms';

@Component({
selector: 'app-modal',
templateUrl: './modal.component.html',
styleUrls: ['./modal.component.scss']
})
export class ModalComponent implements OnInit, OnChanges {
@ViewChild('closeBtn')
closeButton: ElementRef = new ElementRef('');
@Input()
modalTitle = null;
@Input()
hidden = true; // Our own variable, nothing to do with HTML5 hidden global boolean attribute
@Input()
tabIdx = '0';
@Output()
modalClosed = new EventEmitter<boolean>();

modal = 'this is the modal string';

constructor() {}

ngOnInit() {}

ngOnChanges(changes: SimpleChanges) {
if (!changes.hidden) {
return;
}

if (!changes.hidden.currentValue) {
setTimeout(() => {
this.closeButton.nativeElement.focus();
}, 100);
}
}
onModalClose() {
this.hidden = true;
this.modalClosed.emit(this.hidden);
}
}