Accessing and writing client-created cookies in AngularJS
Thursday, July 11, 2013 at 11:31AM
Ken Rimple

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.

Article originally appeared on Random Thoughts (
See website for complete article licensing information.