title: Does my ng-model really need to have a dot to avoid child $scope problems?
body: <p>According to <a href="https://github.com/angular/angular.js/wiki/Understanding-Scopes" rel="noreferrer">https://github.com/angular/angular.js/wiki/Understanding-Scopes</a>, it's a problem to try to data-bind to primitives attached to your <code>$scope</code>:</p>
  
  <blockquote>
    <p>Scope inheritance is normally straightforward, and you often don't even need to know it is happening... until you try 2-way data binding (i.e., form elements, ng-model) to a primitive (e.g., number, string, boolean) defined on the parent scope from inside the child scope. It doesn't work the way most people expect it should work.</p>
  </blockquote>
  
  <p>The recommendation is</p>
  
  <blockquote>
    <p>This issue with primitives can be easily avoided by following the "best practice" of always have a '.' in your ng-models </p>
  </blockquote>
  
  <hr>
  
  <p>Now, I have this very simple setup which violates these rules:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input type="text" ng-model="theText" /&gt;
  &lt;button ng-disabled="shouldDisable()"&gt;Button&lt;/button&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>function MyController($scope) {
      $scope.theText = "";
      $scope.shouldDisable = function () {
           return $scope.theText.length &gt;= 2;
      };
  }
  </code></pre>
  
  <p>Is this really bad? Is this going to screw me over in some horrible way when I start trying to use child scopes, somehow?</p>
  
  <hr>
  
  <p>Do I need to change it to something like</p>
  
  <pre><code>function MyController($scope) {
      $scope.theText = { value: "" };
      $scope.shouldDisable = function () {
           return $scope.theText.value.length &gt;= 2;
      };
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;input type="text" ng-model="theText.value" /&gt;
  &lt;button ng-disabled="shouldDisable()"&gt;Button&lt;/button&gt;
  </code></pre>
  
  <p>so that I follow the best practice? What concrete example can you give me where the latter will save me from some horrible consequence that would be present in the former?</p>