Hey guys,
so basically i’m having a real headache trying to get ionic storage module, and SQLite working correctly, i’m relatively new to Ionic and have been struggling to understand the structure a little bit.
i’ve managed to create a schema for an SQLite database that i want to implement onto a device although i’m not even sure where i’d have to place the .db file in the project file structure.
I have installed the relevant modules for storage use as per documentation here
However, i’m struggling to find decent examples of how to implement this code correctly (saving data, and calling it back and printing it out).
sorry for being a noob at this .
in pseudo code, this is the scenario i want to achieve:
- person registers a user account in app that stores locally on the device.
- registration button is clicked. and triggers a (click)=“register(firstname, lastname, dob, password, email)”; where the code for register would look something like:
import { Storage } from '@ionic-storage';
constructor (private storage: Storage, [...]){}
register(firstname: string, lastname: string, dob: string, password: string, email:string): void {
this.storage.set('firstname', firstname).then( ()=> {
this.storage.set('lastname', lastname).then(()=> {
[...]
} ).catch((e)=>{
JSON.stringify(e)
});
}
if any of that makes sense… if someone could point me into the right direction that would awesome; or if they have the SQLite equivalent then that would be awesome too.
Kind Regards.