Hi,
I try to create simple app with init page where i load data from json file and then change this page to next page with side menu.
The problem occurs when i try change page by “nav.setRoot(MainPage)”. This method double trigger the class MainPage.
app.ts
@Component({
template:<ion-nav id="initNav" #initNav [root]="rootPage"> INIT PAGEA </ion-nav>
,
providers: AppConfig.PROVIDERS
})
export class MyApp {
private rootPage: any = InitPage;constructor(public platform: Platform) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
});
}
}
ionicBootstrap(MyApp);
initPage.ts
@Component({
templateUrl: ‘build/pages/initPage/initPage.html’
})
export class InitPage {
constructor(private navCtrl: NavController) {
}
ngAfterViewInit() {
this.navCtrl.setRoot(MainPage);
}
}
mainPage.ts
@Component({
templateUrl: ‘build/pages/mainPage/mainPage.html’
})
export class MainPage {
constructor() {
}
mainContent: any = HomePage;
menuContent: any = MenuPage;
}
mainPage.html
<ion-nav id=“main” #mainNav [root]=“mainContent”>
<ion-menu [content]=“mainNav”>
<ion-nav #sidemenu id=“sidemenuNav” [root]=“menuContent”>