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

MatAutocompleteTrigger optionSelections Observable stops working #14777

Open
dliechti opened this Issue Jan 10, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@dliechti
Copy link

dliechti commented Jan 10, 2019

What is the expected behavior?

The AutocompleteTrigger.optionSelections Observable emits the value of the selected Element (and the counter increases).

What is the current behavior?

The AutocompleteTrigger.optionSelections Observable does not emit a new value.

What are the steps to reproduce?

https://stackblitz.com/edit/autocomplete-force-selection-4cyhez?file=app%2Fapp.component.ts

  1. Type 'Material' in the autocomplete field
  2. Delete it.
  3. Type 'Ma'
  4. Select 'Mary'

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

  • Angular Material: 7.21, 5,2,5 .

Is there anything else we should know?

This is also true for other AutocompleteTrigger Observables like panelClosingActions.

@andrewseguin andrewseguin added the P3 label Jan 10, 2019

@mmalerba

This comment has been minimized.

Copy link
Contributor

mmalerba commented Jan 10, 2019

I don't think it's a bug with autocomplete, you just need to add markForCheck() after to trigger change detection to update the counter element: https://stackblitz.com/edit/autocomplete-force-selection-pv5wgb?file=app/app.component.ts

@mmalerba mmalerba closed this Jan 10, 2019

@dliechti

This comment has been minimized.

Copy link

dliechti commented Jan 12, 2019

That does not solve the issue. Follow the steps I provided. If you type in 'Google' so there are no suggestions for autocomplete then delete everything again an chose an available option the counter does not increase.

@mmalerba

This comment has been minimized.

Copy link
Contributor

mmalerba commented Jan 13, 2019

Ah I see, yes I am able to reproduce it. I will re-open this issue

@mmalerba mmalerba reopened this Jan 13, 2019

@crisbeto crisbeto added the has pr label Jan 13, 2019

crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 13, 2019

fix(autocomplete): optionSelections not emitting when the list of opt…
…ions changes

Fixes the `MatAutocompleteTrigger.optionSelections` stopping to emit when the list options has been swapped out.

Fixes angular#14777.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment