本文整理汇总了TypeScript中@angular/material.MatDialog.open方法的典型用法代码示例。如果您正苦于以下问题:TypeScript MatDialog.open方法的具体用法?TypeScript MatDialog.open怎么用?TypeScript MatDialog.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/material.MatDialog
的用法示例。
在下文中一共展示了MatDialog.open方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: editCourse
editCourse({description, longDescription, category}:Course) {
const dialogConfig = new MatDialogConfig();
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
dialogConfig.data = {
description, longDescription, category
};
const dialogRef = this.dialog.open(CourseDialogComponent,
dialogConfig);
dialogRef.afterClosed().subscribe(
val => console.log("Dialog output:", val)
);
}
示例2: onCreateClientClicked
public onCreateClientClicked(): void {
let creationDialog = this.dialog.open(ClientCreationDialog);
creationDialog
.afterClosed()
.subscribe(dialogResult => {
if (!dialogResult) {
return;
}
let creationResult = dialogResult.Result as ClientCreationResult;
if (creationResult != ClientCreationResult.Success) {
return;
}
let createdClient = dialogResult.client as Client;
this.snackbar.open(`'${createdClient.name}' was created successfully`, "OK", {
duration: 5000
});
this.clients.unshift(createdClient);
});
}
示例3: verifyAction
public verifyAction(confirmation: ConfirmSettings): Observable<ConfirmResponseTypes> {
let result = new Subject<ConfirmResponseTypes>();
confirmation.confirmText = confirmation.confirmText || "OK"
confirmation.cancelText = confirmation.cancelText || "Cancel";
let settings = {
width: '500px',
disableClose: true,
hasBackdrop: true,
data: confirmation
};
this.dialog.open(VerifyActionComponent, settings)
.afterClosed().subscribe(response => {
result.next(response);
});
return result.asObservable();
}
示例4: open
/**
* Opens the dialog. Returns the chosen value after the user accepts.
* @param title The title to display in the dialog
* @param choices The available choices
* @param multiSelect turn on the option to select multiple entries.
* The answer.items will then be an array.
* @param actions optional strings for buttons replacing the regular confirmation.
* The answer.action will reflect the button selected
* @param clearChoice A string for an extra, visually slightly separated
* choice for 'explicitly set an empty selection'. The answer's action may
* have this string's value
* @returns an answer {@link ChoiceAnswer}
*/
public async open(
title: string,
choices: ChoiceDialogOptions,
multiSelect: boolean = false,
actions?: string[],
clearChoice?: string
): Promise<ChoiceAnswer> {
const dialogRef = this.dialog.open(ChoiceDialogComponent, {
minWidth: '250px',
maxHeight: '90vh',
disableClose: true,
data: {
title: title,
choices: choices,
multiSelect: multiSelect,
actionButtons: actions,
clearChoice: clearChoice
}
});
return dialogRef.afterClosed().toPromise();
}
示例5: onCreatePolicyClicked
public onCreatePolicyClicked(): void {
let creationDialog = this.dialog.open(PolicyCreationDialog);
creationDialog
.afterClosed()
.subscribe(dialogResult => {
if (!dialogResult) {
return;
}
let creationResult = dialogResult.result as PolicyCreationResult;
if (creationResult != PolicyCreationResult.Success) {
return;
}
let createdPolicy = dialogResult.policy as Policy;
this.snackbar.open(`"${createdPolicy.name}" was created successfully`, "OK", {
duration: 5000
});
this.policies.unshift(createdPolicy);
});
}
示例6: openDialog
openDialog(offre, id) {
const dialogRef = this.dialog.open(DialogComponent, {
//height: '350px',
width: '400px'
});
/*
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.apiService.postOffre(offre, id)
.subscribe(res => {
this.maj();
}, (err) => {
console.log(err);
});
//} else {
//console.log("Envoie refusĂŠ.");
//}
});*/
}
示例7: dropFiles
dropFiles(): Observable<DropFilesAction> {
return this.dialog.open(DropFilesDialogComponent, new MatDialogConfig()).afterClosed();
}
示例8: confirm
confirm(title: string, message: string): Observable<boolean> {
const config = new MatDialogConfig();
config.data = { title, message };
return this.dialog.open(ConfirmDialogComponent, config).afterClosed();
}
示例9: pickDemo
pickDemo(): Observable<DemoInfo> {
return this.dialog.open(DemoDialogComponent, new MatDialogConfig()).afterClosed();
}
示例10: openModal
/**
* Open change password modal
*/
openModal(id: string): void {
let dialogRef = this.dialog.open(ModalChangePasswordComponent, {
data: {}
});
}