title: Why i can not get the update value in an AngularJs factory?
body: <p>I am trying to update and then get the update value of an AngularJs factory, I am setting the value in one scope and trying to get it in another, I am setting a factory to handle the pop up messages in my app so instead of repeating my self I want just one factory to handle the messages.</p>
  
  <pre><code>myApp.factory('msg',function ($modal) {
      factory = {};
  
      factory.text = '';
      factory.modal;
      factory.response;
  
      factory.window = function () {
          this.modal = $modal.open({
              templateUrl:'partials/message/confirm.html',
              controller:'cms'
          });
      }
  
      factory.setText = function (text) {
          this.text = text;
      }
  
      factory.getResponse = function () {
          return this.response;
      }
  
      factory.confirm = function () {
          this.modal.close();
          this.response = true;
      }
  
      factory.cancel = function () {
          this.modal.close();
          this.response = false;
      }
  
      factory.confirmSave = function () {
          this.text = 'save';
          this.window();
      }
  
      factory.confirmUpdate = function () {
          this.text = 'update';
          this.window();
      }
  
      factory.confirmDelete = function () {
          this.text = 'delete';
          this.window();
      }
  
  
      return factory;
  });
  </code></pre>
  
  <p>the users controller</p>
  
  <pre><code>myApp.controller('users',function ($scope,$location,$http,msg) {
      $http.get('api/v1/users')
      .success(function (data,status) {
          $scope.user = data;
      })
      .error(function (data,status) {
          $location.path('/login');
      });
  
      $scope.showWrite = function () {
          $scope.write = true;
      }
  
      $scope.closeWrite = function () {
          $scope.write = false;
          $scope.newUser = '';
      }
  
      $scope.save = function () {
          $http.post('api/v1/users/store',$scope.newUser)
          .success(function (data,status) {
  
              $scope.user.unshift({
                  first_name: $scope.newUser.first_name,
                  last_name: $scope.newUser.last_name,
                  email: $scope.newUser.email,
                  role: $scope.newUser.role
              });
  
              $scope.write = false;
              $scope.newUser = '';
          })
          .error(function (data,status) {
              alert('failed');
          });
      }
  
      $scope.confirmDelete = function (index,id) {
          msg.confirmDelete();
          if(msg.getResponse() === true){
              $http.get('api/v1/users/destroy/'+id)
              .success(function (data,status) {
                  $scope.user.splice(index,1);
              })
              .error(function (data,status) {
                  alert('failed');
              });
          };
          console.log(msg.getResponse());
      }
  
      $scope.showUserInfo = function () {
  
      }
  
  });
  </code></pre>