Ionic 2 async initialization

Trying to migrate my v1 app to v2. For the app initialization, as i’m using PouchDB which is async when saving documents, and i need some docs before the app is usable, i was using the router resolve like this:

.state('app', {
  url: "/app",
  abstract: true,
  templateUrl: "templates/sidemenu.html",
  resolve: {
    dbready: function(nxDb, nxConfig, nxModels) {
      /* Inicializar la base */
      return nxDb.setup().then(function() {
        return nxModels.readFromDb();

That way, user can only start interacting/using the app when the database is ready initialized (nxDb.setup, and nxModels.readFromDb, etc)

Now with ionic 2, i’ cant find the correct way of doing that.

Any body can give me a hand?


Well in ionic 2 navigation doesn’t work with state, you have two options, use the LIFO stack navigation provided by ionic 2 or use the new router that comes with Angular 2, anyway, you should make that kind of configs in the app.js or app.ts inside the application’s this.platform.ready().then(() => {...} block.