title: How to make sure clients have enough words in textarea by using angularjs in order to disable/enable a button?
body: <p>I am trying to enable a button if the client enters a certain amount of words, but disable it if their word count is not met.</p>
  
  <p>I started simply by using character length instead of words by using an "if" "else" condition, but could not get the desired result. I have used "ng-model" in a textarea element, but every time I refresh the page it always has "true" or "false" in the textarea already typed, and when I delete it, it always enables the button. And when I enter a single character in textarea the button gets disabled. </p>
  
  <pre><code>&lt;span ng-controller="pract"&gt;
     &lt;textarea id="blogVal" ng-model="btnChange" placeholder="Share"&gt; 
     &lt;/textarea&gt;
     &lt;button ng-disabled="btnChange" class="btnpost"&gt;Post&lt;/button&gt;
  &lt;/span&gt;
  </code></pre>
  
  
  
  <pre><code>var app = angular.module("app", []);
  app.controller("pract", ($scope) =&gt; {    
      $scope.clientValLength = document.getElementById("blogVal").value.length;
      if ($scope.clientValLength &lt;= 7) {
          $scope.btnChange = true;
      } else {
          $scope.btnChange = false;
      }
  });
  </code></pre>