AngularJS conditional ng-disabled does not re-enable

That’s because HTML attributes are always strings, so in your example ngDisabled is evaluating a string in both cases (“true” or “false”).

To remedy, you should compare the model against the string value in ngDisabled:

ng-disabled="new_account == 'false'"

… or use a checkbox, to get the actual boolean value:

<input type="checkbox" ng-model="existing_account" name="register" id="checkbox_new_account" />
<label for="checkbox_new_account">Is Existing Account</label>

Password:
<input type="password" ng-disabled="existing_account" name="password" ng-model="password" />

Here’s a PLNKR with both solutions.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)