title: Google Chrome issue: Model for input type 'password' not updated but 'text' does when browser autofills saved values
body: <p>I have a login Form that is validated using Angular validation as follows:</p>
  
  <p>HTML for Input fields:</p>
  
  <pre><code>                                &lt;input id="loginName" name="loginName" type="text" class="form-control" placeholder="Username" data-ng-model="loginName" data-ng-maxlength="246" required&gt;
  
                                  &lt;input id="password" name="password" type="password" class="form-control" placeholder="Password" data-ng-model="password" data-ng-maxlength="246" required&gt;
  </code></pre>
  
  <p>'Login' button is validated against loginName and password fields using angular validation. </p>
  
  <p>In Google Chrome (other browsers behave as intended) when these fields are saved (with do you want to save username and password feature) when the page is refreshed, the model for input type 'text' -> $scope.loginName gets updated with the saved value on the other hand the model for input type 'password' -> $scope.password is always empty) and according to the validation logic form is declared invalid and the 'Login' button stays disabled even though both the input fields are populated with saved information (See first attached image).</p>
  
  <p>The moment a keypress or mouse click even occurs(not necessarily on the input fields but anywhere on the web page), somehow the model for password is updated and form is validated as shown in the second image attached. </p>
  
  <p>I tried using autofocus, custom autofocus directives, timeouts but it doesn't seem to work as intended.</p>
  
  <p>any suggestions, probably moving the cursor to the end of the text field so that the form knows that the text has been entered in the password field by the browser?</p>
  
  <p>Came across this: <a href="https://stackoverflow.com/questions/14965968/angularjs-browser-autofill-workaround-by-using-a-directive/16800988#16800988">AngularJS browser autofill workaround by using a directive</a></p>
  
  <p>NOTE: All he answers in above solution talk about input elements value, got by either .val() or .value methods but the tricky part is both return undefined in case of password input field.</p>
  
  <p>But no luck!</p>
  
  <p>Thanks.</p>
  
  <p><a href="https://i.stack.imgur.com/5NlWs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5NlWs.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/sIieL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sIieL.png" alt="enter image description here"></a></p>