Trying to utilize a template reference variable to call a method from a parent component to child component. Here's the attempted approach:
File: navigation.component.html
<button type="button" class="btn btn-primary relative waves-light" (click)="CartTable.loadCart()" mdbWavesEffect>My Cart</button>
<app-cart-table-modal #CartTable></app-cart-table-modal>
File: cart-table-modal.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-cart-table-modal',
templateUrl: './cart-table-modal.component.html',
styleUrls: ['./cart-table-modal.component.scss']
})
export class CartTableModalComponent implements OnInit {
constructor() { }
loadCart(){
console.log('load cart called');
}
}
Encountering an error message:
ERROR TypeError: jit_nodeValue_5(...).loadCart is not a function
Any suggestions on how to resolve this error would be greatly appreciated. Thank you in advance.