material
material copied to clipboard
select: option with value of 0 is not selected when using debounce
Actual behavior:
- What is the issue? Can't select option with value
0
- What is the expected behavior? I would expect the option to be selected.
CodePen or Steps to reproduce the issue: *
- CodePen Demo which shows your issue : http://codepen.io/ramtob/pen/KMdwmJ
- Plnkr demo: http://plnkr.co/edit/NrsFSBlFFxSvoxe93L4A?p=preview
- Details: Try to select the first option (its
ng-value
resolves to0
). See that it is not selected. Remove the debounce (set it to 0 for instance) and see it doesn't reproduce.
Angular Versions: *
- Angular Version: 1.5.6
- Angular Material Version: 1.0.9
Additional Information:
- Browser Type: Chrome
- Browser Version: 50.0.2661.102 m
- OS: Windows
- Stack Traces:
I've solved it in my case using this PR: https://github.com/angular/material/pull/8702 (thanks to @ramtob for a thorough debugging).
I could have just used ngModel.$options.debounce = 0
or something but thought someone might want to actually use the debounce on the select as well (as it was in my case).
I had the same problem when binding a Select component to a list of enums. When I select the first item in the list (With value 0) it updates the model but not the value in the select component. I have to re click on the select component for it to update.
I was able to reproduce this with AngularJS 1.6.6 and AngularJS Material 1.1.5. https://codepen.io/Splaktar/pen/ppwqed
The current PR (#8702) author has been unresponsive to requests for squashing of commits and addition of a unit test. If someone else from the community would like to submit a PR that addresses these issues, it would be welcomed. Thank you.