Chris N
Posts: 0
Joined: Thu Mar 19, 2015 5:18 pm

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Hello Chris,

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

Chris N
Posts: 0
Joined: Thu Mar 19, 2015 5:18 pm

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

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.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

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

Argia
Posts: 0
Joined: Thu May 21, 2015 6:48 am

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Hi Sergiy,

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

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

Thanks!

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

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.

Chris N
Posts: 0
Joined: Thu Mar 19, 2015 5:18 pm

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Hi Alena,

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

Jukka8703986
Posts: 0
Joined: Thu Oct 27, 2016 9:03 am

Bootstrap/AngularJS HTML5 localStorage and sessionStorage

Use;

localStorage.setItem("name", value);

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

Return to “Issues”