Skip to content
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

feature(autocomplete): add @Input() disabled property #7269

Closed
julianobrasil opened this issue Sep 23, 2017 · 6 comments · Fixed by #7271
Closed

feature(autocomplete): add @Input() disabled property #7269

julianobrasil opened this issue Sep 23, 2017 · 6 comments · Fixed by #7271
Assignees

Comments

@julianobrasil
Copy link
Contributor

Bug, feature request, or proposal:

The autocomplete should have a disabled input. Sometimes you want to mark the associated input as readonly (you do not want the disabled styles applied to the input) and do not want the autocomplete to fire up when you click on the component (in the cases you have some minimal default options)

What is the expected behavior?

To have an @Input() disabled in autocomplete. As the Datepicker has a disabled property, to keep the consistency, the autocomplete should have one too.

What is the current behavior?

Without the @Input() disabled you have to clear up the array, what is a not so difficult task, but it would be more consistent if it had a disabled property, like Datepicker.

@crisbeto crisbeto self-assigned this Sep 23, 2017
@crisbeto
Copy link
Member

crisbeto commented Sep 23, 2017

I'm not sure that adding another @Input is the way to solve it. What about not opening the autocomplete for readonly inputs in the first place?

@julianobrasil
Copy link
Contributor Author

julianobrasil commented Sep 23, 2017

Yep. Differently from the Datepicker, not opening the panel makes sense for the autocomplete.

crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 23, 2017
Prevents the autocomplete panel from opening if the associated input is readonly.

Fixes angular#7269.
andrewseguin pushed a commit that referenced this issue Sep 29, 2017
Prevents the autocomplete panel from opening if the associated input is readonly.

Fixes #7269.
@Upimage
Copy link

Upimage commented Oct 9, 2017

Sorry, guys, but the latest change breaks all my forms in my application. I use a readonly input when ever the user should choose form a list of values instead of typing a new value. There are some rare situations in my application when the user can type a new value into the same input. While I can use a md-select for readonly and an autocomplete for edits, this solution results in more code and more complicated HTML.
Please, add an "readonly/disabled" flag to the autocomplete element instead of disabling the autocomplete when the input is readonly.

@julianobrasil
Copy link
Contributor Author

@Upimage, I think this can help you: #3334

Specifically, I'd take a look at @willshowell's solution: #3334 (comment)

@kamok
Copy link

kamok commented Apr 2, 2018

Using readonly="{{disabled}}" kinda works. But it doesn't have the goodies that the regular disabled does, such as visual and cursor effects. Kinda whack to have to implement those css manually.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants