I have a global footer in my ionic app, the way I did it is this way. I added the selector component inside the ion-nav and it is working well. My footer is showing in every page.
in the app.html
<ion-nav [root]="rootPage" #content swipeBackEnabled="false">
</ion-nav>
<call-footer #CallChild></call-footer>
However, in one the pages, I want to have control of the footer and I may hide it or change the variables inside it. In my footer component i have a function called 'test' and in one of the pages('calls') I am trying this.
calls.ts
import { Component, OnInit, ViewChild} from '@angular/core';
import { oncallpage } from '../calls/oncall/oncall';
import { callfooter } from '../../components/callfooter/callfooter.component';
@Component({
selector: 'page-calls',
templateUrl: 'calls.html'
})
export class callspage implements OnInit {
@ViewChild('CallChild') child;
constructor() { }
ngAfterViewInit() {
this.child.test(); //error
}
However I am getting "Cannot read property 'test' of undefined"
I am not sure if there is a syntax error or I am missing some idea. How can I solve this case?