title: getting and setting value in factory in angualrjs
body: <p>This is my factory:</p>
  
  <pre><code>.factory('userService',()){
    var user = {};
    return {
  
    getFirstname : function () {
      return user.firstname;
    },
  
    setFirstname : function (firstname) {
      user.firstname = firstname;
    }
  
  }
  </code></pre>
  
  <p>And I'm using this service in my two controllers MainCtrl and AccountEditCtrl
  I'm using my getFirstname() in my MainCtrl and setFirstname in AccountEditCtrl</p>
  
  <pre><code>.controller('MainCtrl',['userService', function(userService){
    $scope.userName = userService.getFirstName();
  }]);
  
  .controller('AccountEditCtrl',['userService', function(userService){
        userService.setFirstname("New First Name");
  }]);
  </code></pre>
  
  <p>My problem is that when I use the userService.setFirstname() the $scope.userName don't change in MainCtrl.</p>