question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Selecting reset option in mat-select

See original GitHub issue

Bug, feature request, or proposal:

When undefined (reset) option is selected in mat-select, and you open the options list and select the undefined option again, both valueChange and ngModelChange events are fired. When you do the same with non-undefined option, none of the events is fired.

What is the expected behavior?

I would expect undefined options to behave same as non-undefined ones, i. e. not to fire an event when the same option is selected twice.

What is the current behavior?

See above.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-hbmfjn-wk5qdh

Small example in Stackblitz. Undefined option is set as default. Try opening the options list and select the undefined (None) option again. You can see that both valueChange and ngModelChange events are fired (see the timestamps below the mat-select).

You can try selecting any non-undefined option twice and observe the timestamps. You will see that the events are fired only once (after the first selection), but not again when you select the same option for the second time.

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

Issue occurs in both Chrome and IE on Win7. Not tested anywhere else.

Is there anything else we should know?

Probably not.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:28
  • Comments:10

github_iconTop GitHub Comments

19reactions
sorakycommented, Aug 27, 2019

Is there any thing new with this issue? Every other work around isn’t really a solution.

4reactions
eTallangcommented, Dec 7, 2018

What’s the status on this issue? Any chance it will be merged anytime soon?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reset a mat-select value by clicking a button - Stack Overflow
Ok, good idea. But the question here is, how do I reset the mat-select button on its initial state, by clicking a clear...
Read more >
Select with reset option - StackBlitz
Select with reset option.
Read more >
Reset MatSelect. What I learned today - Niel de Wet
One can reset an Angular Material Select component by adding a mat-option with no value attribute. ... The first, “All”, option has no...
Read more >
Select | Angular Material
It is possible to disable the entire select or individual options in the select by using the disabled property on the <select> or...
Read more >
Angular Material Select : Getting and Setting value
Angular Material Select is created using mat-select which is a form control for selecting a value from a set of options.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found