-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disabled
on mdInput doesn't work when formControl directive is used(works with native el)
#2667
Comments
disabled
on mdInput doesn't work when formControl directive is useddisabled
on mdInput doesn't work when formControl directive is used(works with native el)
cc @mmalerba |
+1 Seems like disabled Input has a few issues: |
I can reproduce this bug, but it seems to work when adding the disabled directive manually.
|
@kara I think this is a result of #2565. you changed it so that if a form control is present that takes precedence. Is this current behavior the correct behavior? get disabled() {
return this._ngControl ? this._ngControl.disabled : this._disabled;
} or do we want this? get disabled() {
return this._ngControl ? this._ngControl.disabled || this._disabled : this._disabled;
} |
Discussed offline with @mmalerba. In short, the behavior is right in that the control should always take precedence over the disabled property. Otherwise, if you disable the control programmatically without setting the disabled property (as is typical of reactive form pattern), the input will not pick up the new disabled state. The internal property is really intended for forms that aren't using either of the core forms modules. @fxck is correct that standalone (unbound) disabled values* do behave slightly differently from how they work in native inputs. While both throw warnings in the console that the pattern is not recommended, mdInput completely ignores the property, whereas native inputs kind of work in that they disable the UI (though they don't update the control). I'm not certain that we want to spend time to make the unbound disabled property "kind of" work, given that it's already a pattern we're warning people not to use. This is an area that we should really work on in Angular core because the behavior still isn't consistent. For that reason, I'm closing this issue. If anything, a change should be on the other end. *As opposed to doing something like |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
see http://plnkr.co/edit/AvPMHB3lzqwaexypHkUR?p=preview
I've read some issues on
angular/angular
and apparentlydisabled
shouldn't work at all when reactive forms are used. But it looks like it does on native elements and doesn't on element withmdInput
directive.cc @kara
The text was updated successfully, but these errors were encountered: