我在我的水疗中心使用MatDialog,需要将MatDialogConfig传递给已调用的组件。有什么办法吗?
答案 0 :(得分:2)
您可以使用componentInstance
的{{1}}。只需获得对话框的参考,即可获得MatDialogRef<T>
:
打开对话框的方法:
MatDialogRef
对话框组件:
openDialog(dialogConfig: MatDialogConfig) {
let dialogRef = this.dialog.open(MyDialogComponent);
// You can rename the dialogConfig instance to whatever you want. See the next code snippet for more info.
dialogRef.componentInstance.dialogConfig = dialogConfig;
}