title: Entering empty space enables the submit button in angular form how to trim and validate
body: <p>I have a form, In this form I need to validate the password field. in my form field if I enter just a empty space the <code>submit</code> button getting enabled. so how to prevent this kind of scenario?</p>
  
  <p>As well I would like to check the "re-enter" password field against my password field how can I compare both?</p>
  
  <p>once both of them are correct I would like to enable the submit button. even I may required to restrict the user to enter min 6 character in the password field.</p>
  
  <p>At present I am not getting any error at all.</p>
  
  <p>her is my code :</p>
  
  <pre><code>&lt;form name="myForm" novalidate ng-submit="myFormDetails(userInfo)"&gt;
  
        &lt;label for="password"&gt;
          Enter Password
          &lt;input type="password" name="password" ng-model="userInfo.password" id="password" required&gt;
          &lt;span class="error"  
            ng-show="myForm.password.$dirty &amp;&amp; myform.password.$invalid"&gt;
              Please Provide Valid Password
            &lt;/span&gt;
        &lt;/label&gt;
  
        &lt;label for="password"&gt;
          Re-Enter Password
          &lt;input type="password" name="repassword" id="repassword" ng-model="userInfo.repassword" required&gt;
          &lt;span class="error" 
          ng-show="myForm.repassword.$dirty &amp;&amp; myform.repassword.$invalid"&gt;
            Password not matching
        &lt;/span&gt;
        &lt;/label&gt;
        &lt;label for="submit"&gt;
          &lt;button type="submit" ng-disabled="myForm.$invalid"&gt;Submit&lt;/button&gt;
        &lt;/label&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p><a href="http://plnkr.co/edit/8z5PtueBhEcoMvRHrtWA?p=preview" rel="nofollow">Live Demo</a></p>