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

Input changedetection not triggered when input is used as autocomplete-trigger and OnPush ChangeDetectionStrategy used #5271

Closed
diginikkari opened this issue Jun 21, 2017 · 5 comments

Comments

@diginikkari
Copy link

Bug, feature request, or proposal:

When using OnPush changedetection strategy, input with mdAutocomplete directive is not triggering changedetection when value is set in initialization.

What is the expected behavior?

When formcontrol value is set, changedetection should be triggered and placeholder text should be elevated.

What is the current behavior?

When formcontrol value is set, changedetection is not triggered. If there is placeholder text, it is not elevated when input value is set on initialization.

What are the steps to reproduce?

In linked plunker there is two md-inputs other with mdAutocomplete and other normal. Input placeholder text is elevated on normal md-input but not in input with autocomplete.

http://plnkr.co/edit/eLpDqe?p=preview

What is the use-case or motivation for changing an existing behavior?

To be able to use OnPush-changeDetectionstrategy.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 4.2.3
Material 2.0.0-beta.7

Is there anything else we should know?

nope

@willshowell
Copy link
Contributor

Duplicate of #3005.

Also there is an upcoming effort to make all components OnPush #5035

@diginikkari
Copy link
Author

Most of the inputs are already working in OnPush, but input used as MdAutocomplete-trigger is not yet working. Therefore I think this issue is valid.

@willshowell
Copy link
Contributor

All the autocomplete-trigger is doing is taking the value you provide and setting the native input's value with the results of displayWith(). This happens after a Promise.resolve().

You can see in this plunker that it's the exact same thing with the input when you set the value after initializing it: http://plnkr.co/edit/4olO7E?p=preview

Basically it's all the same underneath. I acknowledge there is some trickery happening with the trigger manually floating and resetting the placeholder, but those methods are only run during the opening and closing of the panel and are not related to simply setting the value of the control.

Again, I may be wrong but when #3005 is fixed, it seems this too will be. 😃

@josephperrott
Copy link
Member

Closing as it looks like this has been resolved if you are still seeing the issue feel free to open up an issue for us to take a look.

@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 7, 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

No branches or pull requests

3 participants