I have a form with a username and password field and a login button. The login button is only enabled when the username field is not empty.
However when Chrome autofills the fields the login button stays disabled until I click somewhere on the page.
How can I make my app recognise that the username is not blank.
I created this javascript, which executes after the fields have been populated:
$timeout(function(){
var field= angular.element('#username');
if (field.length && field.val().length > 0) {
var button= angular.element('#login_button');
button.removeClass('disabled');
}
}, 1000);
But it doesn't work because field.val()
is always just read as an empty string.