我正在试用角度材料中提到的md-dialog
https://material.angular.io/components/dialog/examples
constructor(public dialog: MdDialog) {}
openDialog(): void {
let dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
width: '250px',
data: { name: this.name, animal: this.animal }
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.animal = result;
});
}
它工作正常,我的问题是我无法使用构造函数初始化MdDialog
是否有某些方法可以初始化MdDialog
并使用类似这样的内容
let dialogRef = new MdDialog()