NavController.getActive() does not seem to work in Ionic View


#1

When using this in my app.component.ts:

export class MyApp {
    @ViewChild(Nav) nav: Nav;
..
..

the code this.nav.getActive().component.name returns the name of the current page, as expected, when running the app in browser with ionic serve. It also works when using the Ionic Dev app, and also when i run the app in a simulator. But - I need this to work in when i run the app in the Ionic View also, and it doesn’t. I don’t get anything when trying to print out the value of this.nav.getActive().component.name in the app.html. Is there any way i can get this to work with Ionic View?

Thanks in advance.
Lars


#2

I don’t have to do it this way, but i need some kind of way for the app.component.ts to know which is the current page viewed. And the important thing here - i need it to work with the Ionic View app.

Any good ideas?


#3

For some reason i had set --prod flag on the build. (in package.json)
I removed that, and everthing works fine.