Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Ionic 2 async initialization

$
0
0

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:

$stateProvider
.state('app', {
  url: "/app",
  abstract: true,
  templateUrl: "templates/sidemenu.html",
  resolve: {
    dbready: function(nxDb, nxConfig, nxModels) {
      /* Inicializar la base */
      return nxDb.setup().then(function() {
        nxConfig.readFromLocalStorage();
        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?

Cheers!


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>