In my current situation, the getComponent method is no longer available. Here's what I am dealing with:
Within app.ts and app.html files, there are two components - a menu component and a nav component. The nav component contains a page with tabs. When the menu, part of the app component, is clicked, I want to switch tabs.
Previously, I could easily achieve this using:
this.app.getComponent('mytabs').select(3)
Now, I realize that I need to utilize ViewChild, so I attempted both methods:
@ViewChild('mytabs') tabs:Tabs;
The ion-tab component has a reference #mytabs.
And
@ViewChild(Tabs) tabs:Tabs;
Both times, the this.tabs variable returned undefined. My assumption is that the component is not yet available when the app.ts component is initialized. What options do I have in this scenario?
Here is the information about my Ionic setup:
Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.7
Ionic CLI Version: 2.0.0-beta.29
Ionic App Lib Version: 2.0.0-beta.16
OS:
Node Version: v4.4.0