Being a Frontend Web Developer, I am trying to grasp an understanding of exactly when and why to either chose key/value storage vs. sqlite. That could also be part of such a tutorial, which I am looking forward to watching ;)
Hello i tried this in ionic 2 but having issue in getting data outside of the below function, it gives value in console.log but undefined outside where i want to use this data. I tried every trick and methods but did not get any success...Please help me how to get data back from storage.... getStartTime(){ this.storage.get('stime').then( (val) => { this.stime = val; console.log(this.stime); }); if(this.stime !== null){ return this.stime; }else{ return 0; } }
Nice video as always. Question, if I may... So would you need to be hooked up'to the Internet to use this storage function? If I had an app that I wanted use somewhere with no Wi-Fi, would the app be rendered useless if it'depended on this storage function?
If you're using a more recent version of ionic-storage (2.0.0+), see here for how to add it to app.module.ts: github.com/ionic-team/ionic-storage/releases/tag/v2.0.0
I am just learning ionic and your videos are a huge help. thank you. I do not know if something has changed since you made this, but adding Storage to providers in app.module.ts was causing an error for me, I had to add "IonicStorageModule.forRoot()" in imports. as i said I am just learning and I am not sure what the ramifications to this change are/mean yet but i thot I would give you a heads up. thanks again.
Hi Josh, great video thanks. I have a special request on how to save an image in IONIC 2 to remote storage e.g. Firebase? I have tried to do it for weeks but still getting to nowhere .... :(.
Is it possible to inject the storage into a custom provider? I'm getting this error when I try. "Cannot read property set of undefined". I have included the storage library and injected it into the constructor.
i like your videos but i kindda started hating sublime text 2 I am getting error Cant resolve all parameters for Storage ? Any 1 getting the same thing and know how to overcome it ??
Hi Josh... Many thanks for the vid... Quick question... Is there any way of storing "deeper" data in storage i.e. objects, rather than a simple key/data pair? So something like: {“items” : [{ ”itema”: true, “itemb”: false }], "boxes": [{ ”boxa”: true, “boxb”: false }] } Then add items to items and boxes to boxes? Many thanks again. :)
Does it do the same if I used File in stead of storage? Because that can do much more... you can create files and directories and so on... And does the Storage also survive a restart of the application or if you force it to get closed?
Yes, you can store a JSON object on a single key using Storage. When using browser based storage there is a limit (I think it is 5MB, though that may have changed), when using SQLite then yes, I believe it is only limited by available space on the device.
I'm getting the data from a http request, the code looks like this: this.storage.ready().then(() => { if(this.wordPressData != null ){ this.storage.set('myData', this.wordPressData); }
I'll be really happy if you did a SQLite video, and how to store data in tables.
Storing data in key value pairs, isn't the best in every situation.
Being a Frontend Web Developer, I am trying to grasp an understanding of exactly when and why to either chose key/value storage vs. sqlite. That could also be part of such a tutorial, which I am looking forward to watching ;)
Hello i tried this in ionic 2 but having issue in getting data outside of the below function, it gives value in console.log but undefined outside where i want to use this data. I tried every trick and methods but did not get any success...Please help me how to get data back from storage....
getStartTime(){
this.storage.get('stime').then( (val) => {
this.stime = val;
console.log(this.stime);
});
if(this.stime !== null){
return this.stime;
}else{
return 0;
}
}
Comigo, funcionou após por o comando pra criar o database
Is it possible to add more data in the existing json file?
Nice video as always. Question, if I may... So would you need to be hooked up'to the Internet to use this storage function? If I had an app that I wanted use somewhere with no Wi-Fi, would the app be rendered useless if it'depended on this storage function?
If you're using a more recent version of ionic-storage (2.0.0+), see here for how to add it to app.module.ts: github.com/ionic-team/ionic-storage/releases/tag/v2.0.0
Thanks a lot!
how to save the value of radio button or drop down list in API any suggestion .........??
Hi Joshua,
Property 'set' does not exist on type 'IonicStorageModule'. same issue with get. What to do next ?
I am just learning ionic and your videos are a huge help. thank you. I do not know if something has changed since you made this, but adding Storage to providers in app.module.ts was causing an error for me, I had to add "IonicStorageModule.forRoot()" in imports. as i said I am just learning and I am not sure what the ramifications to this change are/mean yet but i thot I would give you a heads up. thanks again.
Can I store embeded youtube videos using storage?
Hi Josh, great video thanks. I have a special request on how to save an image in IONIC 2 to remote storage e.g. Firebase? I have tried to do it for weeks but still getting to nowhere .... :(.
Is it possible to inject the storage into a custom provider? I'm getting this error when I try. "Cannot read property set of undefined". I have included the storage library and injected it into the constructor.
hey Joshue, thank you for great videos! what difference between LocalStorage to Sqlite?
i like your videos but i kindda started hating sublime text 2
I am getting error
Cant resolve all parameters for Storage ?
Any 1 getting the same thing and know how to overcome it ??
Hi Josh... Many thanks for the vid...
Quick question...
Is there any way of storing "deeper" data in storage i.e. objects, rather than a simple key/data pair?
So something like:
{“items” :
[{
”itema”: true,
“itemb”: false
}],
"boxes":
[{
”boxa”: true,
“boxb”: false
}]
}
Then add items to items and boxes to boxes?
Many thanks again. :)
Just tested a solution... we can simply build an object and send it in as the 2nd param of "set"... so...
this.storage.set('items', itemsObject);
love the videos, very helpful so far. Could you do a video on how to persist data to a API endpoint? I've been trying for over a week with no luck.
Does it do the same if I used File in stead of storage? Because that can do much more... you can create files and directories and so on... And does the Storage also survive a restart of the application or if you force it to get closed?
I'm getting the error " Can't resolve all parameters for storage " . Could someone help me with that ?
How to display that data as html component? I'm new in Ionic.
how to use sqlite ? please create new tutorial !!! i really love your teach .
Good explanation mate, very clear and concise.
please create video, how to generate apk, android and windows 10 mobile, tks !
I'm using Visual Studio 2015 Community Edition to make my apps.
taco.visualstudio.com
And there are instructions for using Ionic.
Thank you very much
Nice shit!
It's possible to put a JSON object in storage, correct?
The limit of storage is the available space on device?
Yes, you can store a JSON object on a single key using Storage. When using browser based storage there is a limit (I think it is 5MB, though that may have changed), when using SQLite then yes, I believe it is only limited by available space on the device.
I'm trying to store JSON Data, but its not working any ideas, Thanks
try to use JSON.encode({ x: 5, y: 6 }); to write and JSON.decode to read.
I'm getting the data from a http request, the code looks like this:
this.storage.ready().then(() => {
if(this.wordPressData != null ){
this.storage.set('myData', this.wordPressData);
}
Is it possible to save data locally (offline app) and then sync with database online? How to do this?
Yes - check out PouchDB for this, it can sync to any database that uses the CouchDB protocol.
Joshua Morony
Is the Storage you used in this example only browser based or is it for native storage?
Both - if the SQLite plugin is installed it will use that, if not it will use browser storage
Could we use the same syntax with the SQLite plugin or do we have to write queries?
No. SQLite uses querys like select from table, create table, update table etc.