title: How to load $cookies in Angular service?
body: <p>I've defined an angular service in which I'd like to access some a cookie. Looking at the AngularJS docs it seems that <a href="https://docs.angularjs.org/api/ngCookies/service/$cookieStore" rel="nofollow">$cookieStore is deprecated</a> 
  and that <code>$cookies</code> should be favored. Here is how my service looks:</p>
  
  <pre><code>'use strict';
  
  var lunchrServices = angular.module('lunchrServices', ['ngCookies']);
  
  lunchrServices.service('authService', ['$cookies', function ($cookies) {
      var user = $cookies.get('user') || null;
  
      this.login = function (userEmail) {
          user = userEmail;
          $cookies.put('user', userEmail)
      };
      this.logout = function () {
          user = null;
          $cookies.put('user', null);
      };
      this.currentUser = function(){
          return user;
      }
  
  }]);
  </code></pre>
  
  <p>which errors out the on the <code>$cookies.get('user')</code> call with <code>TypeError: undefined is not a function</code>. However, if I change every instance of <code>$cookies</code> to <code>$cookieStore</code> it works perfectly (shown below):</p>
  
  <p>'use strict';</p>
  
  <pre><code>var lunchrServices = angular.module('lunchrServices', ['ngCookies']);
  
  lunchrServices.service('authService', ['$cookieStore', function ($cookieStore) {
      var user = $cookieStore.get('user') || null;
  
      this.login = function (userEmail) {
          user = userEmail;
          $cookieStore.put('user', userEmail)
      };
      this.logout = function () {
          user = null;
          $cookieStore.put('user', null);
      };
      this.currentUser = function(){
          return user;
      }
  
  }]);
  </code></pre>
  
  <p>I'd like to use <code>$cookies</code> but can't figure out why it fails when <code>$cookieStore</code> doesn't. Any ideas?</p>