最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - difference between $cookiestore and $cookies in angularjs - Stack Overflow

programmeradmin2浏览0评论

What is the difference between $cookiestore and $cookies in angularjs.

I saw the angularjs document.

$cookiestore and $cookies are doing same think, but the only difference is

$cookiestore- can objects put or retrieved from this storage are automatically serialized or deserialized by angular's toJson/fromJson .but $cookies- can't do this

Is the only one difference? or anything else?

What is the difference between $cookiestore and $cookies in angularjs.

I saw the angularjs document.

$cookiestore and $cookies are doing same think, but the only difference is

$cookiestore- can objects put or retrieved from this storage are automatically serialized or deserialized by angular's toJson/fromJson .but $cookies- can't do this

Is the only one difference? or anything else?

Share Improve this question edited Apr 20, 2015 at 13:50 Ramesh Rajendran asked Apr 7, 2015 at 5:51 Ramesh RajendranRamesh Rajendran 38.7k49 gold badges159 silver badges240 bronze badges 1
  • 1 I would look into this more, but the docs say: "Deprecated: (since v1.4.0) Please use the $cookies service instead." so it seems kind of moot. docs.angularjs/api/ngCookies/service/$cookieStore – jbobbins Commented Dec 2, 2016 at 17:31
Add a ment  | 

1 Answer 1

Reset to default 5

I think the description of each in the documentation makes it quite clear:

$cookie just gives you access to cookies same as if you did by some other method.

$cookieStore uses cookies to make a key/value storage solution for you.

So if you are starting something new and want to persist key/value pairs use $cookieStore

If you want to use existing cookie solution - say read/write cookies from your existing server session system then use $cookie.

发布评论

评论列表(0)

  1. 暂无评论