本文整理匯總了TypeScript中@angular/material/dialog.MatDialog類的典型用法代碼示例。如果您正苦於以下問題:TypeScript MatDialog類的具體用法?TypeScript MatDialog怎麽用?TypeScript MatDialog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了MatDialog類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: openAlert
/**
* params:
* - config: IAlertConfig {
* message: string;
* title?: string;
* viewContainerRef?: ViewContainerRef;
* closeButton?: string;
* }
*
* Opens an alert dialog with the provided config.
* Returns an MatDialogRef<TdAlertDialogComponent> object.
*/
public openAlert(config: IAlertConfig): MatDialogRef<TdAlertDialogComponent> {
let dialogConfig: MatDialogConfig = this._createConfig(config);
let dialogRef: MatDialogRef<TdAlertDialogComponent> =
this._dialogService.open(TdAlertDialogComponent, dialogConfig);
let alertDialogComponent: TdAlertDialogComponent = dialogRef.componentInstance;
alertDialogComponent.title = config.title;
alertDialogComponent.message = config.message;
if (config.closeButton) {
alertDialogComponent.closeButton = config.closeButton;
}
return dialogRef;
}
示例2: openConfirm
/**
* params:
* - config: IConfirmConfig {
* message: string;
* title?: string;
* viewContainerRef?: ViewContainerRef;
* acceptButton?: string;
* cancelButton?: string;
* }
*
* Opens a confirm dialog with the provided config.
* Returns an MatDialogRef<TdConfirmDialogComponent> object.
*/
public openConfirm(config: IConfirmConfig): MatDialogRef<TdConfirmDialogComponent> {
let dialogConfig: MatDialogConfig = this._createConfig(config);
let dialogRef: MatDialogRef<TdConfirmDialogComponent> =
this._dialogService.open(TdConfirmDialogComponent, dialogConfig);
let confirmDialogComponent: TdConfirmDialogComponent = dialogRef.componentInstance;
confirmDialogComponent.title = config.title;
confirmDialogComponent.message = config.message;
if (config.acceptButton) {
confirmDialogComponent.acceptButton = config.acceptButton;
}
if (config.cancelButton) {
confirmDialogComponent.cancelButton = config.cancelButton;
}
return dialogRef;
}
示例3: openPrompt
/**
* params:
* - config: IPromptConfig {
* message: string;
* title?: string;
* value?: string;
* viewContainerRef?: ViewContainerRef;
* acceptButton?: string;
* cancelButton?: string;
* }
*
* Opens a prompt dialog with the provided config.
* Returns an MatDialogRef<TdPromptDialogComponent> object.
*/
public openPrompt(config: IPromptConfig): MatDialogRef<TdPromptDialogComponent> {
let dialogConfig: MatDialogConfig = this._createConfig(config);
let dialogRef: MatDialogRef<TdPromptDialogComponent> =
this._dialogService.open(TdPromptDialogComponent, dialogConfig);
let promptDialogComponent: TdPromptDialogComponent = dialogRef.componentInstance;
promptDialogComponent.title = config.title;
promptDialogComponent.message = config.message;
promptDialogComponent.value = config.value;
if (config.acceptButton) {
promptDialogComponent.acceptButton = config.acceptButton;
}
if (config.cancelButton) {
promptDialogComponent.cancelButton = config.cancelButton;
}
return dialogRef;
}
示例4: closeAll
/**
* Wrapper function over the closeAll() method in MatDialog.
* Closes all of the currently-open dialogs.
*/
public closeAll(): void {
this._dialogService.closeAll();
}
示例5:
/**
* params:
* - component: ComponentType<T>
* - config: MatDialogConfig
* Wrapper function over the open() method in MatDialog.
* Opens a modal dialog containing the given component.
*/
public open<T>(component: ComponentType<T>, config?: MatDialogConfig): MatDialogRef<T> {
return this._dialogService.open(component, config);
}
示例6: openDialog
openDialog() {
const dialogRef = this.dialog.open(DialogContentExampleDialog);
dialogRef.afterClosed().subscribe(result => {
console.log(`Dialog result: ${result}`);
});
}
示例7: openDialog
openDialog(): void {
let dialogRef = this.dialog.open(ProjectEditDialogComponent, {
width: '450px',
height: '400px'
});
dialogRef.afterClosed().subscribe(result => {
console.log('The edit project dialog was closed');
});
}
示例8: openVerifyDialog
openVerifyDialog(candidate) {
const candidateName = `${candidate.rank.abbreviation} ${candidate.lastName}, ${candidate.firstName}`;
const verified = candidate.record.verified;
let dialogRef = this.dialog.open(CandidateVerifyDialog, {
width: '500px',
data: { candidateName, verified }
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.changeVerification(candidate);
}
});
}
示例9: onRemove
onRemove(record: Contact) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: 'Are you sure you want to delete this record?'
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.contactsService
.remove(record._id)
.subscribe(
() => {
this.refresh();
this.snackBar.open('Record removed successfully!', 'X', {
duration: 3000,
verticalPosition: 'top',
horizontalPosition: 'center'
});
},
error => this.onError('Error while trying to delete the record.')
);
}
});
}
示例10: openDialog
openDialog() {
this.dialog.open(DialogElementsExampleDialog);
}