I have a function on click event at parent html.
<span (click)="onFilterClick()" class="filter-icon">
<mat-icon>keyboard_arrow_down</mat-icon></span>
<m-scp-filter-template [openFilter]="true" *ngIf="templateFor === 'col1' "></m-scp-filter-template>
child component at parent ts
@ViewChild(ScpFilterTemplateComponent) myChild;
the function at parent ts
onFilterClick() {
this.myChild.openMenu();
}
and called function at child ts
openMenu() {
console.log('successfully executed.');
}
but I getting error
'TypeError: Cannot read property 'openMenu' of undefined at ScpDataTableComponent.'