Deal transaction component renders the deals-approval.component, Deal transaction component has the editDeal function ,
How do I call that and use (editRowEvent)="editDeal($event)" on deals-approval.component.html without duplicating the code which is editDeal ?
Thanks.
#deal transaction component
<div>
<app-deals-approval [transaction]="transaction"></app-deals-approval>
</div>
<app-table-multi-sort
(dataServiceEvent)="dealsServiceEvent($event)"
[tableOptions]="tableOptions"
[tableData]="data"
(tableActionsEvent)="tableActions($event)"
(editRowEvent)="editDeal($event)">
</app-table-multi-sort>
</div>
#deal transction ts code
editDeal(deal:any){
let dealType = '';
switch(deal.dealType){
case 'PM Restructure':
dealType = this.DEAL_TYPES.PMR
break;
default:
break;
}
const state = {
data: {
transaction: this.transaction,
dealId: deal.id,
dealType: dealType,
dealName: deal.name,
breadCrumbsPath:[
{
text: 'My transactions',
link: '/transactions',
},
{
text: this.transaction.name,
link: `/transactions/overview/${this.transaction.id}`,
},
]
},
}
this.gotoDealDetails(state);
}
#deals-approval.component.html - I wand this (editRowEvent)="editDeal($event)" on deals-approval but the function is on Deal transaction component, how to call that from here?
<div style="padding-bottom: 20px;" [ngClass]="{'hide':!hasApproval}">
<app-table-multi-sort
(editRowEvent)="editDeal($event)"
(dataServiceEvent)="dataForApprovalServiceEvent($event)"
[tableOptions]="tableOptions"
[tableData]="data">
</app-table-multi-sort>
</div>