December 2014
Intermediate to advanced
272 pages
8h 17m
English
AngularJS provides a couple of services for getting and setting cookies: $cookie and $cookieStore. Cookies provide temporary storage in a browser and persist even when the user leaves the web page or closes the browser.
The $cookie service enables you to get and change string cookie values by using dot notation. For example, the following code retrieves the value of a cookie with the name appCookie and then changes it:
var cookie = $cookies.appCookie;$cookies.appCookie = 'New Value';
The $cookieStore service provides get(), put(), and remove() functions to get, set, and remove cookies. A nice feature of the $cookieStore service is that it serializes ...
Read now
Unlock full access