本文整理汇总了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);
}