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

md-select deselects when the value is 0 (instead of selecting the item with value of zero) #5031

Closed
geelus opened this issue Jun 8, 2017 · 14 comments

Comments

@geelus
Copy link

geelus commented Jun 8, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Selecting the value 0

What is the current behavior?

Deselects everything

What are the steps to reproduce?

One your changes for version beta 6 is:
"select: allow option with undefined or null value to clear selection (#3141) (13524c1), closes #3110 #2634"
This causes the issue of deselecting if the value is 0. So it deselects the mdselect if it's null or undefined or zero.
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: https://goo.gl/DlHd6U

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

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

beta 6

Is there anything else we should know?

@geelus geelus changed the title md-select issue with value 0 (zero) md-select deselects when the value is 0 (instead of selecting the item with value of zero) Jun 8, 2017
@crisbeto
Copy link
Member

crisbeto commented Jun 8, 2017

This has been fixed in master and will be in the next release. See 2e3910c.

@crisbeto crisbeto closed this as completed Jun 8, 2017
@geelus
Copy link
Author

geelus commented Jun 8, 2017

Perfect. Thanks

@geelus
Copy link
Author

geelus commented Jun 8, 2017

I checked the link and I guess it's a different issue. My problem is that when my ngModel is zero, instead of selecting the option zero, it deselects it all.

@crisbeto
Copy link
Member

crisbeto commented Jun 8, 2017

It should be the same issue. Can you reproduce it in a Plunkr? You can use this one which runs the latest build.

@geelus
Copy link
Author

geelus commented Jun 8, 2017

If you believe so, I trust you. I will when I get a chance.

@crisbeto
Copy link
Member

crisbeto commented Jun 8, 2017

We had a similar PR today and I wasn't able to reproduce it in this Plunkr. I'm not sure whether you have a different setup though.

@geelus
Copy link
Author

geelus commented Jun 8, 2017

Here is the plunker:
http://embed.plnkr.co/showVK2SkoBhUyBFOyKr/

but I'm getting a strange error:
"Can't bind to 'ngModel' since it isn't a known property of 'md-select'"
how come???!!!

@crisbeto
Copy link
Member

crisbeto commented Jun 8, 2017

It's because the template doesn't include the FormsModule. Here's a fixed version and it also looks like selecting 0 works.

@geelus
Copy link
Author

geelus commented Jun 10, 2017

Thank you for fixing the issue. Is the plunker you sent the one in dev (fixed) or beta 6 (released)?

@crisbeto
Copy link
Member

The Plunkr is using the latest master build.

@geelus
Copy link
Author

geelus commented Jun 10, 2017

Perfect! so it's fixed.

@jonsamwell
Copy link

Any idea when the next release is that will deliver this fix?

@geelus
Copy link
Author

geelus commented Jun 14, 2017

Good question. I would love to know too.

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