Many ways to share data between components, input binding, services you name it... https://angular.io/guide/inputs-outputs
But I'm going out on a limb here and taking a guess what could work. The overlying mat-table where you select the row appears to be a dialog modal.
The modal is probably opened somewhere from the parent component, most likely where Delivery Receipt# is too?
So when we open the modal, we will subscribe to the modal. We will start listening to the value emitted by the modal when the modal closes (i.e when user does selectedRow() we close modal and return value). That return value is then catched and fed to Delivery Receipt#.
In parent
constructor(public dialog: MatDialog) {}
deliveryReciept: any;
// here we open the modal, and pass in data for mat-table
// your modal name is probably different
openDialog(): void {
const dialogRef = this.dialog.open(DeliveryRecieptDialog, {
width: '250px',
data: {DeliveryReceipt: this.DeliveryReceipt, selectedReceipt: null},
});
// here we listen to what user selected
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.deliveryReciept = result.selectedReceipt;
});
}
In the modal:
DeliveryReceipt: any;
selectedReceipt: any;
constructor(
public dialogRef: MatDialogRef<DeliveryRecieptDialog>,
@Inject(MAT_DIALOG_DATA) public data: DialogData,
) {
this.DeliveryReceipt = data.DeliveryReceipt;
this.selectedReceipt = data.selectedReceipt;
}
selectedRow(row){
console.log('selectedRow', row);
this.selectedReceipt = row
this.dialogRef.close();
}
The above is an explanation how to return data from modal and then use return data where it was opened from, you may have to change the previous code for it to actually work in your project.