对话框的组件:
constructor(@Inject(MAT_DIALOG_DATA)
public data: any,
public dialogRef: MatDialogRef<MyDialogComponent>,
@Optional() public dialogtitle: string ) {}
致电部分:
openMyDialog(somedata: string){
const myDialogRef = this.dialog.open(MyDialogComponent, {data: somedata});
}
如何将可选参数“dialogtitle”的数据放在那里?
答案 0 :(得分:0)
我猜你正在使用棱角分明的材料?
constructor(public dialogRef: MatDialogRef<MyDialogComponent>,
@Optional() @Inject(MAT_DIALOG_DATA) public dialogtitle: string ) {}