storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document Ionic root page & page navigation

brodybits opened this issue · comments

From #594 (comment) by @rodineijf:

Hi @brodybits, by default the attribution of rootPage on ionic 2 is on declaration of var rootPage. I can solve my problem moving the rootPage attribution to the platformReady on app.component

initializeApp() {
this.platform.ready().then(() => {

  this.rootPage = MyPage;
  StatusBar.styleDefault();
  Splashscreen.hide();
});
}

With a quick search I think the following resources may be relevant:

I think the root cause is the requirement to wait for the deviceready event in Cordova. This has been a stumbling block in so many cases and is especially bad for working with Ionic and other Angular apps.

Totally true. Assigning the root page inside the platform ready event has fixed my problem with sqlite plugin.

I agree with @brodybits. I guess if you assign the root page before the platform ready event is fired, and you use the plugin inside the page, it crashes.

Actually, I'm getting this problem and was not solved by assigning the root page inside the platform ready. It just build with no erros sometimes, and if I get a error, a need to try saving many times 'til it builds it correctly. And no changes are made in the code to it simply work.

As example, I just tried to tap a "space" and save de project, the SQLite worked.
Few seconds after, I did the same, and the SQLite plugin acused the error.