Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Accessing and Writing Client-Created Cookies in AngularJS

DZone's Guide to

Accessing and Writing Client-Created Cookies in AngularJS

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

AngularJS provides a $cookieStore object that reads and writes cookies. Here is a sample JSFiddle (my new favorite toy) that demonstrates setting a cookie value and bumping it by one each time the button is clicked.

Note - you won't see the number bump in the iFrame-embedded JSFiddle... Only if you jump to the JSFiddle site to test with it! This is Cross-Site Scripting protection in action...

Original discussion source was this Stack Overflow article.

Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}