<a href='http://github.com/angular/angular.js/edit/master/src/ngCookies/cookies.js' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this doc</a>



<a href='http://github.com/angular/angular.js/tree/master/src/ngCookies/cookies.js#L21' class='view-source pull-right btn btn-primary'>
  <i class="glyphicon glyphicon-zoom-in">&nbsp;</i>View Source
</a>


<header class="api-profile-header">
  <h1 class="api-profile-header-heading">$cookies</h1>
  <ol class="api-profile-header-structure naked-list step-list">
    
  

    <li>
      - service in module <a href="api/ngCookies">ngCookies</a>
    </li>
  </ol>
</header>



<div class="api-profile-description">
  <p>Provides read/write access to browser&#39;s cookies.</p>
<p>Only a simple Object is exposed and by adding or removing properties to/from this object, new
cookies are created/deleted at the end of current $eval.
The object&#39;s properties can only be strings.</p>
<p>Requires the <a href="api/ngCookies"><code>ngCookies</code></a> module to be installed.</p>

</div>




<div>
  

    

  

  
  
  



  
  <h2 id="example">Example</h2><p>

<div>
  <a ng-href="http://plnkr.co/edit/ngdoc:example-example65@{{docsVersion}}?p=preview" class="btn pull-right" target="_blank">
    <i class="glyphicon glyphicon-edit">&nbsp;</i>
    Edit in Plunker</a>
  <div class="runnable-example"
      path="examples/example-example65">

   
    <div class="runnable-example-file" 
      name="index.html"
      language="html"
      type="html">
      <pre><code>&lt;script&gt;&#10;  function ExampleController($cookies) {&#10;    // Retrieving a cookie&#10;    var favoriteCookie = $cookies.myFavorite;&#10;    // Setting a cookie&#10;    $cookies.myFavorite = &#39;oatmeal&#39;;&#10;  }&#10;&lt;/script&gt;</code></pre>  
    </div>
  

    <iframe class="runnable-example-frame" src="examples/example-example65/index.html" name="example-example65"></iframe>
  </div>
</div>

</p>

</div>


