20 lines
552 B
TypeScript
20 lines
552 B
TypeScript
import { Component } from '@angular/core';
|
|
import { ModalService, ModalType } from '../../services/modal.service';
|
|
|
|
@Component({
|
|
selector: 'app-modal',
|
|
templateUrl: './modal.component.html',
|
|
styleUrls: ['./modal.component.scss']
|
|
})
|
|
export class ModalComponent {
|
|
// Needed for accessing the enum from html.
|
|
ModalType = ModalType;
|
|
|
|
constructor(public modalService: ModalService) {
|
|
window.addEventListener('keydown', (event: KeyboardEvent) => {
|
|
if (event.key === 'Escape') {
|
|
this.modalService.cancel();
|
|
}
|
|
});
|
|
}
|
|
}
|