Localstorage in JS

37 views
Skip to first unread message

Adarsh C

unread,
Jul 22, 2015, 10:05:36 AM7/22/15
to AngularJS
Hello,

I am setting a value in localstorage in angularjs. How can i retrieve this value in normal javascript?
Please help if anybody knows it.

With Regards
Adarsh C

Samuel Castro e Silva

unread,
Jul 22, 2015, 10:10:17 AM7/22/15
to ang...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--

Samuel Castro

Full Stack Developer

(37) 9110-8850

Adarsh C

unread,
Jul 22, 2015, 10:27:00 AM7/22/15
to AngularJS

Yes Samuel,
I am setting the value in angularJS. I could do this.

But I need to retrieve this value in normal javascript.

Thanks for the reply

With Regards
Adarsh C

Samuel Castro e Silva

unread,
Jul 22, 2015, 10:44:08 AM7/22/15
to ang...@googlegroups.com
What do you mean with normal javascript?

Because with $cookieStore you can save and retrieve javascript objets with no problem.



--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Mark Volkmann

unread,
Jul 22, 2015, 10:56:06 AM7/22/15
to ang...@googlegroups.com
You can access it like any other JavaScript object.
localStorage.foo = 'bar';
console.log(localStorage.foo);

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
R. Mark Volkmann
Object Computing, Inc.

Damith Premakumara

unread,
Jul 24, 2015, 1:44:19 AM7/24/15
to AngularJS, cad...@gmail.com


hi 
   Something like this,Try it
  
 // Set value
 localStorageService.set('loginUserData',{
    userId:12,
    userName:'jone'  
});

//Get value
var user = localStorageService.get('loginUserData');
var loginId =user.UserID;

//remove value
localStorageService.remove('loginUserData');

Reply all
Reply to author
Forward
0 new messages