I want my ionic 3 app to check a localy stored variable right after the app is loaded (after splash), and then set the rootPage accordingly. I need to know where should I put the code for this functionnality.
答案 0 :(得分:0)
Check out the conference Ionic template.
You can create the app directly from the ionic CLI:
ionic start conference-demo conference
The relevant part is in the src/app/app.component.ts
file:
this.storage.get('myStoredVariable')
.then((myStoredVariable) => {
if (myStoredVariable) {
this.rootPage = customPage;
} else {
this.rootPage = defaultPage;
}
});
}