I am opening one dialog from my component.
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');
});
I wan to access few properties from this component to initialize 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) {}
The only way , I could figure out this is using behaviorsubject of rxjs to access properties, However this DialogOverviewExampleDialog is declared inside my component itself. Is there a way to directly access properties of my component inside DialogOverviewExampleDialog ? and vice versa as well.
Thanks,
Use this:
dialogRef.componentInstance.YOUR_PROPERTY