Angular 角度4';这';使用回调时未定义';OnComponentUnitFunction';ng2智能表的功能

Angular 角度4';这';使用回调时未定义';OnComponentUnitFunction';ng2智能表的功能,angular,ng2-smart-table,Angular,Ng2 Smart Table,我在我的组件中使用ng2智能表 我试图调用父组件的approveTheOrder()方法,但无法获取父类的对象 下面是片段 { title: "Actions", type: "custom", renderComponent: ActionRenderComponent, onComponentInitFunction(instance) { instance.actionEmitter.subscribe(row => { if(row == CON

我在我的组件中使用ng2智能表

我试图调用父组件的approveTheOrder()方法,但无法获取父类的对象

下面是片段

{
  title: "Actions",
  type: "custom",
  renderComponent: ActionRenderComponent,
  onComponentInitFunction(instance) {
    instance.actionEmitter.subscribe(row => {
      if(row == CONSTANT.STATUS_APPROVE){
        //here 'row' value is from childComponent-ActionRenderComponent,which I am able to get easily in parentComponet 
       this.approveTheOrder(instance.rowData.id); // here this is undefined, 

      }
      if(row == CONSTANT.STATUS_REJECT){
        this.rejectOrder();//this is undefined
      }
      if(row == CONSTANT.STATUS_PENDING){
        this.pendingOrder(); // this is undefined
      }
    });
  },

  filter: false
};
有人知道如何在下面的OnComponentUnitFunction()中获取“this”吗

下面是我得到的错误图像

另外,我尝试使用“绑定”功能,但未能成功实现目标,请任何人在这里指导我,我真的被困在这一点上

编辑1 请注意,我可以从父组件中的子组件中获取事件,但这里的问题特定于ng2智能表组件

为了从ChildComponent中获取值,我尝试使用ng2智能表组件的内置回调函数onComponentUnitFunction(实例),语法如下:

{
OnComponentUnitFunction(实例){
...
将转换为函数表达式:

{
OnComponentUnitFunction:函数(实例){
...
您应该使用箭头功能来保留此:

OnComponentUnitFunction:(实例)=>{

@Yurzui-是的,你给出的解决方案对我很有效。请随时回答这个问题,这样就不会有其他人被这个问题困扰problem@Z.Bagley-此问题特定于ng smart table,我可以将ChildComponent的值返回到ParentComponent的构造函数中。但问题出现在OnComponentUnitFunction()中功能。道歉、误解和删除。