I am running into a bug with the navController in my code. My code is based on the conference template.
In my app.component file, I have defined a new side menu for one of the tabs. Lets called this tab, tab x. Tab x has a side menu with buttons. The buttons are supposed to push a new page on top of the navigation stack. I realized I couldn’t directly have the buttons navigate from the side menu because this pushes the page above the tabs page. I want to push on top of the tab x.
To get around this, I wrote an event listener in the side menu in the app.component file to publish when click. The tab x page is listening for this event, and when it is fired, it pushes the page I want to navigate to on top of tab x.
This where the bug occurs. The bug refers to the navController.push() line. The exact error states the following:
ERROR TypeError: Cannot read property ‘push’ of null
at Tab.NavControllerBase._queueTrns (nav-controller-base.js:203)
at Tab.NavControllerBase.push (nav-controller-base.js:70)
Strangely enough, this error only occurs when I edit the code and ionic serve rebuilds the app. If I refresh the page with ctrl+r, then the code works as expected.
Any idea on how to get past this bug?