I came across a little problem with the sqlite plugin.
When my App starts i get following execution order:
**** app.config.routers
**** app.run
***** DB INIT
**** Controller: First Page/View
**** Platform is ready!
Thats how i would like it, but this only works with webSQL and not sqlite Plugin because at this time when App.run is executed the plugins are not loaded yet.
im using the wrapper from jgoux: https://gist.github.com/jgoux/10738978
I just changed a part of the factory to this
if (window.navigator.simulator) {
console.log('websql');
self.db = openDatabase(DB_CONFIG.name, DB_CONFIG.version, 'database', -1);
} else {
console.log('sqlite');
self.db = window.sqlitePlugin.openDatabase({ name: DB_CONFIG.name });
}
if i want this to run i have to call DB.init() in $ionicPlatform.ready so I’m sure cordova and plugins are loaded.
but then DB init is run after First Controller.
**** app.config.routers
**** app.run
**** Controller: First Page/View
**** Platform is ready!
***** DB INIT
in my First Controller i have this code to get all data for this view:
Table.all().then(function(data) {
$scope.data = data;
});
do you have some suggestions/experience or would using webSQL be enough?