Password validation not working in Angular
<p>Hi I am trying to validate password using ng-show and error messages are displayed even though the password is correct and also are displayed on page refresh. </p>

<p>My code is  : Form name is : registeruser</p>

<pre><code>&lt;!-- Set a password for the account --&gt;
                        &lt;div class="col-md-12" style="margin: 7px;"&gt;
                            &lt;input type="password" id="password" name="password" style="height: 35px;" class="form-control input-lg" placeholder="Password" ng-model="register_password" required autocomplete="off" /&gt;
                            &lt;!-- Button for viewing password --&gt;
                            &lt;input type="checkbox" id="eye" onclick="if(password.type=='text')password.type='password'; else password.type='text';" /&gt;
                        &lt;/div&gt;
                        &lt;!-- Error Message for password --&gt;
                        &lt;div class="error-message" ng-show="registeruser.password.$invalid"&gt;
                            Please enter at least 6 characters.
                        &lt;/div&gt;
                        &lt;div class="error-message" ng-show="registeruser.password.$pristine"&gt;
                            Please enter your password.
                        &lt;/div&gt;
</code></pre>

<p>I checked the ng-show with the placeholder name, id and model name but it not working. 
Also I want the password error to be displayed if the user tabs out of the password field without entering the password and not on page load when the password field is empty. </p>