Navigating from the Root component

Hello there! As the title suggest, I’m trying to navigate from the root component, as stated in the documentation:

However, I can’t make it work, even although my code is almost the same than in docs but changing @App by @Component. This is my code:

import {Component, ViewChild} from '@angular/core';
import {Platform, ionicBootstrap, NavController, Nav} from 'ionic-angular';

 template: '<ion-nav [root]="rootPage" #content></ion-nav>'

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

constructor(platform: Platform) {
	console.log("MyApp", this.nav);

changePage() {
     console.log("MyApp", this.nav);

Unfortunately, this.nav is always undefined. What is wrong?

Thanks in advance!

So in the constructor, this.nav wont be available since the component hasn’t fully rendered yet. You’ll want to wrap it in a view event

  console.log('MyApp', this.nav);