I’m using tabbed navigation and I’m trying to get the active view from a function I call from my app component. A user could be on any view in the app when this function is called.
But when I call getActive() from within that function, the Nav Controller (which I am getting as @ViewChild in my app component) always returns the Tab View Controller as the active view controller.
@ViewChild('Nav') navCtrl:NavController;
getActiveView(){
let nav = this.navCtrl;
nav.getActive() // returns the Tabs View Controller regardless of the view it is called from
}
As a result, I am unable to get the active view controller from the page that actually is the active view. Is there another way to get the active view from a function that resides in the app controller but can be called from any view in the app?