How can I save data inside the app, without having to use cloud, so that


#1

In documentation for the framework, there is STORAGE, but can I use it inside the creator? How?


#2

This is a question I’d love to see answered. Would be great to have someone give a quick howto on this. Am currently working on an app that would benefit from some local storage of user input - but, like you, struggling to work through it!


#3

Nobody seems to care to help. And there is no support as to help. :slight_smile:


#4

I have used the standard javascript local storage:

// Store
localStorage.setItem(“lastname”, “Smith”);
// Retrieve
localStorage.getItem(“lastname”);


#5

I fully agree here, I am a semi experienced programmer and the way creator implements things are very different. I have just figured out how they run functions differently to what cordova plugin documentation explains . they launched a great product with very basic tutorials but as you said, there is NO support and a handful op people really knows what they are talking about. I might be wrong but over the last couple of months I was left stranded on a simple upload of a picture function which I had to figure out myself. there is NO tutorial, example, video or comment that helped. this is very frustrating. messaging the admin sometimes takes up to 3 days for a reply.


#6

Yeah, and it’s a real shame. The creator - as-is - is actually pretty damn good - and with some additional documentation, demo projects and a few tutorials, I think I’d be really flying along… and, with that, be able to add more to the community myself.

This video update (https://www.youtube.com/watch?v=fRgOb1ghH_Y) gives some indication of perhaps where their focus is – and the comments suggest that more tutorials are planned, but I’m starting to lose confidence in some of the promises - as I know others are.


#7

Thanks tklimek for this – will have a play.


#8

Hey, guys… I’d recommend going through the ionic framework docs, since Creator is basically an IDE for it…

Make sure to go through all the tutorial videos… It got me jumpstarted, and while i’ve had to fiddle a bit, they lead me in the right direction…

About localstorage, yeah… use $window.localStorage… Make sure $window is included in the controller’s main function…


#9

Sorry to revive an old thread, Having the exact same issue and annoyed it hasn’t be highlighted in the creator docs. Literally trying to store a single local variable to decide whether or not a user has already seen the intro tutorial. Encouraging to know you made it work using $window.localStorage though. Just wondering. Does this require ngStorage to be imported?

Because if so ill need to import using the import window in creator and will only be able to test it when I download and do a local build in ionic CLI.


#10

You’ve probably figured this out already @danobolto, but in case this is helpful later, here’s how I’ve done it in my own app to store a list of users. I don’t have a lot of data to store, so I am using the html5 local storage API, which is nice because it works in the creator website, the creator app, and (I presume) the exported native app.

To store data:
localStorage.setItem("users", JSON.stringify(data.users));

To retrieve data:
data.users = JSON.parse(localStorage.getItem("users"));

Doesn’t need anything special to be injected or included, it’s just global based on the item name. I also ended up adding some exception handling around the retrieval.