我正在从我的组件中打开一个对话框。
const dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
width: '500px',
data: DialogData
});
dialogRef.afterClosed().subscribe(result => {
this.dialogData = new DialogData('label...',this.frequency,'action','screen_ocr','parameter_type','parameter_value',0,'next_node',1,'index',false);
console.log('The dialog was closed');
});
我想从该组件访问一些属性来初始化 DialogOverviewExampleDialog
@Component({
selector: 'dialog-overview-example-dialog',
templateUrl: 'dialog-overview-example-dialog.html',
})
export class DialogOverviewExampleDialog {
//here I want to use properties of my component
constructor(private dialogService: DialogDataService,
public dialogRef: MatDialogRef<DialogOverviewExampleDialog>,
@Inject(MAT_DIALOG_DATA) public data: DialogData) {}
唯一的方法,我可以弄清楚这是使用 rxjs 的behaviorsubject 来访问属性,但是这个 DialogOverviewExampleDialog 是在我的组件本身内部声明的。有没有办法直接访问 DialogOverviewExampleDialog 内组件的属性?反之亦然。
Thanks,