Skip to content

MdSelect selected value not cleared if option is removed #2524

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

Closed
petebacondarwin opened this issue Jan 4, 2017 · 1 comment · Fixed by #2560
Closed

MdSelect selected value not cleared if option is removed #2524

petebacondarwin opened this issue Jan 4, 2017 · 1 comment · Fixed by #2560
Assignees

Comments

@petebacondarwin
Copy link

petebacondarwin commented Jan 4, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Removing an option that is currently selected should update the select

What is the current behavior?

If you remove the currently selected option from the options list
the select does not change its current selected value.

What are the steps to reproduce?

See this plunker: http://plnkr.co/edit/cX2VnC8wm4yNnQTmAGxV?p=preview

  • Select the "Third" option and then click on "Pop an option"
  • This will remove the "Third" option
  • The select will still display the "Third" value

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

A classic scenario would be adding an item to a collection from a select, where you only want unselected items to appear in the options list.

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

Angular 2.4.1
Angular Material 2.0.0-beta.1
Tested on Chrome 55 (OS/X 10.12)

Is there anything else we should know?

This is kind of related to #2232 and the fix in #2110 but probably needs the _setSelectionByValue
method to be called in response to the options collection changing.

@devversion devversion self-assigned this Jan 7, 2017
devversion added a commit to devversion/material2 that referenced this issue Jan 7, 2017
* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes angular#2524
devversion added a commit to devversion/material2 that referenced this issue Jan 13, 2017
* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes angular#2524
kara pushed a commit to kara/material2 that referenced this issue Jan 13, 2017
* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes angular#2524
kara pushed a commit to kara/material2 that referenced this issue Jan 13, 2017
* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes angular#2524
devversion added a commit to devversion/material2 that referenced this issue Jan 13, 2017
* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes angular#2524
mmalerba pushed a commit that referenced this issue Jan 18, 2017
* fix(select): remove selection if option is removed

* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes #2524

* Update spec name

* Remove check logic and just keep test

* Update expectation message

* Fix linting

* Wait for zone to be stable
kara pushed a commit to kara/material2 that referenced this issue Jan 20, 2017
* fix(select): remove selection if option is removed

* Currenty when an option is selected and the option is somehow programmatically removed the select updates its options.
  Right now it does not remove the selection if the selection has been removed from the options.

Fixes angular#2524

* Update spec name

* Remove check logic and just keep test

* Update expectation message

* Fix linting

* Wait for zone to be stable
@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

Successfully merging a pull request may close this issue.

2 participants