I am using Ag Grid for displaying a list of items in my Project. I have implemented Ag Grid with colDef for grid as like below
custom.component.ts
CustomComponent
//colum definition array
[
{
headerName: "Actions",
field: "action",
width: 100,
cellRendererFramework: ActionRendererComponent,
},
]
ActionRendererComponent
import {Component} from '@angular/core';
import {AgRendererComponent} from 'ag-grid-ng2/main';
@Component({
selector: 'action-cell',
template: `
<a href="javascript:" *ngIf="showEditLink" (click)="edit()"> Edit</a>
<a href="javascript:" *ngIf="showSaveLink" (click)="save()"> Save</a>
<a href="javascript:" *ngIf="showCancelLink" (click)="cancel()">Cancel</a>
`
})
export class ActionRendererComponent implements AgRendererComponent {
public edit(){
..some logic here
}
public save(){
..some logic here
}
public cancel(){
..some logic here
}
}
Now the issue is i cannot get access to parent instance CustomComponent in any of the functions in ActionRenderer like save(), edit(), cancel(). How can i pass parent instance into ActionRenderer component?