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

fix(select): clear select if no option matches value #2110

Merged
merged 1 commit into from
Dec 16, 2016

Conversation

kara
Copy link
Contributor

@kara kara commented Dec 8, 2016

Closes #2109

r: @jelbourn

@kara kara requested a review from jelbourn December 8, 2016 07:46
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 8, 2016
@kara kara force-pushed the clear branch 2 times, most recently from d9e0d5f to 9acc0dc Compare December 8, 2016 09:39
@kara kara added in progress This issue is currently in progress and removed pr: needs review labels Dec 8, 2016
@kara
Copy link
Contributor Author

kara commented Dec 8, 2016

Noticed a weird animation thing, want to look into it.

Update: Seems like something that is being fixed in core. Creating a separate issue for it.

@kara kara added pr: needs review and removed in progress This issue is currently in progress labels Dec 9, 2016
* found with the designated value, the select trigger is cleared.
*/
private _setSelectionByValue(value: any): void {
this.options.forEach((option: MdOption) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need the type here, just

this.options.forEach(option => {

Should be equivalent

private _setSelectionByValue(value: any): void {
this.options.forEach((option: MdOption) => {
if (option.value === value) {
option.select();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stop iterating if you find a value?

@kara
Copy link
Contributor Author

kara commented Dec 13, 2016

@jelbourn Comments addressed!

* found with the designated value, the select trigger is cleared.
*/
private _setSelectionByValue(value: any): void {
const optionArr = this.options.toArray();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just options- I have a strong aversion to suffixing with types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, changing!

@jelbourn
Copy link
Member

LGTM otherwise

@kara kara added the action: merge The PR is ready for merge by the caretaker label Dec 13, 2016
@jelbourn jelbourn merged commit 2855cc3 into angular:master Dec 16, 2016
@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select should clear selection if setting value programmatically to nonexistent option value
3 participants