title: How to get Cookie value Without page refresh in angular js?
body: <p>Am done login using Popup,After Checked username and password correct means to set the username,type and id in cookie , once page refresh only i get the Cookie value,I want to get the cookie value without page refresh.</p>
  
  <p>My Code:</p>
  
  <pre><code>/*login*/
                  function login(formStatus) {
                      if (formStatus.$valid) {
                          self.scope.userlogin.user_type = 1;
                          UserService.login(self.scope.userlogin, function(response) {
                              if (response.success) {
                                  self.scope.error = null;
                                  UserService.setCredentials(response.result.username, response.result.user_type, response.result.id);
  
                               }
  
  
                          });
                      }
                  }
  </code></pre>
  
  <p>Service Code:</p>
  
  <pre><code>/**
   * Set cookie after login
   */
   this.setCredentials = function (username, type, id) {
      $rootScope.globals = {
          currentUser: {
              username: username,
              type: type,
              id:id
          }
      };
  
      $cookieStore.put('globals', $rootScope.globals);
  };
  </code></pre>
  
  <p>What's Wrong in My code? Once page Refresh only i got that COokie value.
  Please give me Solution.</p>