title: Update controller variable on Updating Angular factory variable
body: <p>Hi I have got one question.
  I have got one object as following in my Factory </p>
  
  <pre><code>User: {
     EmailAddress: ""
  }
  </code></pre>
  
  <p>whenever i make http call I want to update that User.EmailAddress whith returned value. What is the best way of doing it in within the factory? so that at controller level I can just bind my $scope.Email to factory variable. This is what I am doing right now</p>
  
  <pre><code>GetLogOnModel: function () {
      if ($location.path().indexOf("login") == 1) {
          var promise = $http.get(config.headers.url + "LogOn").then(function (response) {
              // The return value gets picked up by the then in the controller.
              User.EmailAddress=response.data.Email;
              return response.data
          });
          return promise;
          // Return the promise to the controller
      }
  }
  </code></pre>
  
  <p>And in Controller</p>
  
  <pre><code>AccountFactory.GetLogOnModel().then(function (data) {
    $scope.logOnModel = data;
  }, function (err) {
    console.log(err.reason);
    alert(err.reason);
  });
  </code></pre>