I'm calling a function declared in parent component in the child component in the form of callback.
Parent Component
translation-editor.component.ts
export class TranslationEditorComponent implements OnInit {
    textGuid: string = this.actRoute.snapshot.params['textGuid'];
    editDataset: any;
    currentTopBarConfig: any;
    summaryTopbarConfig = [
      {
        "label": "Save Text",
        "function": this.save,    //see save function below
      },
      { 
        "label": "Delete Text", 
        "function": this.delete, 
      }
    ];
  constructor(
    private translationService:TranslationService,
    public actRoute: ActivatedRoute,
  ) {
  }
  ngOnInit(): void {
    this.loadDataToEdit();
  }
  loadDataToEdit(){
    this.translationService.getTextById(this.textGuid).subscribe(res => {
      this.editDataset = res;
    })
    this.currentTopBarConfig = this.summaryTopbarConfig;
  }
  save(){
    console.log("this.textGuid",this.textGuid);
    if(this.textGuid){
      this.translationService.updateText(this.textGuid, this.editDataset).subscribe((res:any)=>{
        console.log(res);
      });
    }
  }
  delete(){
 console.log("delete code lies here");
  }
}
translation-editor.component.html
<topbar [config]="currentTopBarConfig"></topbar>
<form  [ngClass]="{'hidden':currentTab!=='summary'}" >
    <fieldset>
      <legend>Field</legend>
      <ul  *ngIf="editDataset">
        <ng-container  *ngFor="let key of objectKeys(editDataset)" >
          <li *ngIf="key === 'textGuid' || key === 'strongName' || key === 'container'">
            <label class="grid-input-group">
              <input type="text" value="{{editDataset[key]}}" readonly>
              <span class="label">{{key}}</span>
            </label>
          </li>
        </ng-container>
      </ul>
    </fieldset>
  </form>
I'm calling the save function in the below component as a callback to initiateFunction() function.
Child Component
topbar.component.html
<ul class="sidebar-items">
<ng-container *ngFor="let btn of config">
  <li>
    <button 
      (click)="initiateFunction(btn.function)"
      <span class="label" >{{btn.label}}</span>
    </button>
  </li>
</ng-container>
</ul>
topbar.component.ts
export class TopbarComponent implements OnInit {
    @Input() config: any[] | undefined;
    constructor(private location: Location) { }
    ngOnInit(): void {
    }
    initiateFunction(fnct:any){
      fnct();
    }
  }
Here when function is executed I'm getting an error:
ERROR TypeError: Cannot read properties of undefined (reading 'textGuid')
Where I'm not able access the this.textGuid.
Please give me suggestions on how to solve this.
 
     
    