projects/maplander/shared/src/lib/components/dialog/dialog.service.ts
Methods |
constructor(_dialog: MatDialog)
|
||||||
Parameters :
|
alert | ||||||||||||||||
alert(title: string, message: string, options: literal type)
|
||||||||||||||||
Parameters :
Returns :
MatDialogRef<DialogComponent>
|
confirm | ||||||||||||||||
confirm(title: string, message: string, options: literal type)
|
||||||||||||||||
Parameters :
Returns :
MatDialogRef<DialogComponent>
|
withInput | ||||||||||||||||
withInput(title: string, message: string, options: literal type)
|
||||||||||||||||
Parameters :
Returns :
MatDialogRef<DialogComponent>
|
import {Injectable} from '@angular/core';
import {MatDialog} from '@angular/material/dialog';
import {DialogComponent} from './dialog.component';
import {MatDialogRef} from '@angular/material/dialog/typings/dialog-ref';
import {DialogType} from '@maplander/types';
@Injectable()
export class DialogService {
constructor(
private _dialog: MatDialog
) {
}
confirm(title: string, message: string, options: {
accept: string,
cancel: string
} = {accept: null, cancel: null}): MatDialogRef<DialogComponent> {
return this._dialog.open(DialogComponent,
{
data:
{
type: DialogType.CONFIRM,
title: title,
message: message,
options: options
},
disableClose: true,
panelClass: 'global_dialog'
}
);
}
alert(title: string, message: string, options: { accept: string } = {accept: null}): MatDialogRef<DialogComponent> {
return this._dialog.open(DialogComponent,
{
data:
{
type: DialogType.ALERT,
title: title,
message: message,
options: options
},
disableClose: false,
panelClass: 'global_dialog'
}
);
}
withInput(title: string, message: string, options: {
placeholder: string,
accept?: string,
cancel?: string
} = {placeholder: null, accept: null, cancel: null}): MatDialogRef<DialogComponent> {
return this._dialog.open(DialogComponent,
{
data:
{
type: DialogType.WITH_INPUT,
title: title,
message: message,
options: options
},
disableClose: false,
panelClass: 'global_dialog'
}
);
}
}