Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

ng-disabled breaks validation if input is prepopulated via ng-model #5

Open
justindmyers opened this issue Nov 16, 2015 · 0 comments
Open

Comments

@justindmyers
Copy link

Testing in Angular 1.2.21, if an input is prepopulated via ng-model, a required validation error will always be thrown if ng-disabled ever evaluates to true. If ng-disabled is always false, then validation still works correctly.

The only solution was to combine ng-disabled with val-if, having one evaluate opposite of the other.

Example:

val_if = "ctrl.isTrue"
ng_disabled = "!ctrl.isTrue"

It looks as if ng-disabled is doing something under the hood that isn't playing nicely with the unobtrusive validation unless you purposefully reset the validation using val_if.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant