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';
@Component({
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!