Modal: Fix UIkit undefined in server

This commit is contained in:
Konstantinos Triantafyllou 2023-05-11 13:04:09 +03:00
parent 6be478cacc
commit 73f2215c07
1 changed files with 7 additions and 3 deletions

View File

@ -185,14 +185,16 @@ export class AlertModal implements OnInit, AfterViewInit, OnDestroy {
* Opens an alert window creating backdrop. * Opens an alert window creating backdrop.
*/ */
open() { open() {
UIkit.modal(this.element.nativeElement).show(); if(typeof UIkit !== "undefined") {
UIkit.modal(this.element.nativeElement).show();
}
} }
/** /**
* ok method closes the modal and emits modalOutput. * ok method closes the modal and emits modalOutput.
*/ */
ok() { ok() {
if (!this.stayOpen) { if (!this.stayOpen && typeof UIkit !== "undefined") {
UIkit.modal(this.element.nativeElement).hide(); UIkit.modal(this.element.nativeElement).hide();
} }
if (!this.choice) { if (!this.choice) {
@ -209,6 +211,8 @@ export class AlertModal implements OnInit, AfterViewInit, OnDestroy {
* cancel method closes the modal. * cancel method closes the modal.
*/ */
cancel() { cancel() {
UIkit.modal(this.element.nativeElement).hide(); if(typeof UIkit !== "undefined") {
UIkit.modal(this.element.nativeElement).hide();
}
} }
} }