title: Value of var goes back to empty after exiting function?
body: <p>So I have an api request inside of a function thats placed in my Service script.. I have defined the variable "curruser" outside of the function so I can keep its value, however after exiting the follow Scirpt, curruser is empty??</p>
  
  <p>services.js</p>
  
  <pre><code>function fbUserInfo() {
    ngFB.api({
      path: '/me',
      params: {
        fields: '/*params*/'
      }
    }).then(
      function(user) {
        curruser = user;
  
        $http.get(/*send GET request to my server*/).success(function(response) {
          if (response.length &lt; 20) {
            curruser.firsttime = true;
          } else {
            curruser.firsttime = false;
          }
          console.log(curruser);
          console.log("1");
        });
      },
  
      function(error) {
        alert('Facebook error: ' + error.error_description);
      });
  }
  </code></pre>
  
  <p>So the console.log would return the proper JSON object I retrieved from facebook.. but when I return it in  the return statement </p>
  
  <pre><code>return {
    userInfo: function() {
      fbUserInfo();
      console.log(curruser);
      return curruser;
    }
  </code></pre>
  
  <p>it returns that curruser is an empty object! I did write </p>
  
  <pre><code>var curruser;
  </code></pre>
  
  <p>into the first line inside the ".factory"</p>