Difference between $ cookiestore and $ cookie in angularjs

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

I saw an angularjs document.

$ cookiestore and $ cookie do the same, but the only difference is

$ cookiestore - objects placed or retrieved from this storage are automatically serialized or deserialized using angular toJson / fromJson.but $ cookie - cannot do this

The only difference? or something else?

+6
source share
1 answer

I think the description of each in the documentation makes this very clear:

$ cookie just gives you access to cookies, as if you were doing some other method.

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

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

If you want to use the existing solution for cookies - download files for reading / writing from the existing system of server sessions, use $ cookies.

+2
source

Source: https://habr.com/ru/post/984769/


All Articles