Q) How can I get my app to work in the browser as before, using WebSQL/SQLite?
I've been using the ionic Storage
module since forever, which enabled my app to run with WebSQL in the browser and SQLite on the device itself.
This was simple and working, now it's broken with RC.0.
My LocalStorageService.ts was like this:
export class LocalStorageService {
constructor(...) { ... }
query(sql: string, params?: any, infoMsg?: string): Promise<any> {
return new Promise(resolve => {
return this._db.executeSql(sql, params).then(
(data) => {
this._LogService.info(infoMsg);
resolve(data);
},
(error) => {
this._LogService.error(error);
resolve(null);
}
);
});
}
}
Then I could call it from any component:
this.LocalStorageService.query('SELECT * FROM blah').then(data => {
// do stuff with results.
});
Note: Key/value pair storage i.e. LocalStorage won't work, I need SQL querying capabilities in the browser+device.
Thanks.