title: Why Can't I change value of the variable? Angular
body: <p>I made a service that stores a variable I use in two controllers. </p>
  
  <pre><code>function CommonVariables() {
      var number = 3;
  
      return {
          setNumber: function(num) {
              number = num;
          },
          getNumber: function() {
              return number;
          }
      }
  };
  </code></pre>
  
  <p>The problem is that I can get this variable like this:</p>
  
  <pre><code>this.number = CommonVariables.getNumber();
  </code></pre>
  
  <p>I want it to be changed like this:</p>
  
  <pre><code>&lt;input class="numInput" ng-model="Ctrl.number"&gt;
  </code></pre>
  
  <p>in Js: </p>
  
  <pre><code>function Controller(CommonVariables) {
      this.number = CommonVariables.getNumber();
      CommonVariables.setNumber(this.number);
  }
  </code></pre>
  
  <p>But I can't and don't understand why</p>