2020-06-16 18:40:48 +02:00
|
|
|
import { ComponentType } from '@angular/cdk/portal';
|
|
|
|
import { Injectable, TemplateRef } from '@angular/core';
|
|
|
|
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
2020-05-05 18:17:12 +02:00
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root',
|
|
|
|
})
|
|
|
|
export class ModalService {
|
2020-06-16 18:40:48 +02:00
|
|
|
constructor(public dialog: MatDialog) {}
|
2020-05-05 18:17:12 +02:00
|
|
|
|
2020-06-16 18:40:48 +02:00
|
|
|
public openModal_OLD<T, K>(componentOrTemplateRef: ComponentType<T> | TemplateRef<T>, data?: K): void {
|
|
|
|
this.dialog.open(componentOrTemplateRef, { data: data });
|
2020-05-05 18:17:12 +02:00
|
|
|
}
|
2020-06-16 18:40:48 +02:00
|
|
|
public openModal<T, D = any>(
|
|
|
|
componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,
|
|
|
|
config?: MatDialogConfig<D>
|
|
|
|
): void {
|
|
|
|
this.dialog.open<T, D>(componentOrTemplateRef, config);
|
2020-05-12 19:16:23 +02:00
|
|
|
}
|
2020-05-05 18:17:12 +02:00
|
|
|
}
|