Page 1 of 1

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Posted: Wed Apr 22, 2015 12:02 am
by Chris N

Are there any plans to support a way to access/modify/map the html5 localStorage and sessionStorage from within Bootstrap/AngularJS projects?


Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Posted: Wed Apr 22, 2015 9:07 am
by Alena Prykhodko

Hello Chris,

This is not planned for Bootstrap/AngularJS projects at this moment, as scope variables implement this logic for Bootstrap/AngularJS.


Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Posted: Wed Apr 22, 2015 4:59 pm
by Chris N

Hi Alena,

If that is the case, what is the recommended way to persist data?

  1. Between different pages/views in the same session

  2. Between new sessions

    I know angular has $cookie, but it doesn't seem robust enough for medium to large amounts of data (large json strings in my case) which should be persisted between sessions.


Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Posted: Wed Apr 29, 2015 10:34 am
by Serhii Kulibaba

1) First of all, we should add scope variable, which generate something like this:
pre$scope.session_token = Apperyio.EntityAPI('string');/pre
2) Then, in ng-init method, by using snippet we create watcher for this variable:
pre$scope.$watch( 'session_token', function(newValue, oldValue){
Apperyio.configAdd( 'SESSION_TOKEN', newValue );
});/pre

3) Use $scope.session_token variable in mapping

4) On next screen user just read it from settings:
pre$scope.session_token_copy = Apperyio.config( 'SESSION_TOKEN' );/pre


Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Posted: Fri May 22, 2015 6:41 am
by Argia

Hi Sergiy,

Where can i find documentation on the code you use above?

I've been trying to find it with no luck.

Thanks!


Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Posted: Sun May 24, 2015 6:32 am
by Illya Stepanov

Hi Argia -

We are working on our documentation and we will update our AngularJS section in near time.

The code that Sergiy provided are all AngularJS concepts.


Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Posted: Tue Jul 07, 2015 4:54 pm
by Chris N

Hi Alena,

What about persisting data beyond sessions (which currently happens via localStorage), what is the recommended method using the Bootstrap/AngularJS tools?


Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Posted: Tue Nov 15, 2016 2:44 pm
by Jukka8703986

Use;

localStorage.setItem("name", value);

Its not visible in the Appery IDE but it's working