Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(ngSelect): Support static options on multi-select drop down #5938

Conversation

siddii
Copy link
Contributor

@siddii siddii commented Jan 22, 2014

Removes a condition where static options are not added as part of render function when multiple attribute is enabled

Closes #4325

Removes a condition where static options are not added as part of render function when multiple attribute is enabled

Closes angular#4325
} else if (!selectedSet) {
// option could not be found, we have to insert the undefined item
optionGroups[''].unshift({id:'?', label:'', selected:true});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like it's going to fail jshint/tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't see any failure on "grunt test"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran grunt jshint & its all green. Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

from the diff, it looks like there should be an unexpected closing brace. if not then ignore the comment, but the diff looks like it. Travis is being a bit slow right now, but we'll know soon enough :)

Copy link
Contributor

Choose a reason for hiding this comment

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

just took a second look at this diff and now feels stupid for the above comments

derp

@pkozlowski-opensource
Copy link
Member

@caitp try diff excluding whitespaces: siddii@db96f77?w=1

@caitp
Copy link
Contributor

caitp commented Jan 23, 2014

@siddii could you explain clearly what this is actually solving? I'm going to put this down under 1.3.x but I feel like some info is needed. If this is fixing a proper bug with some real impact I'll try to squeeze it in earlier

Actually, it sounds like this is probably good for 1.2.10... so, I'll see if we can do that

@siddii
Copy link
Contributor Author

siddii commented Jan 23, 2014

@caitp - There was some assumption made in the code where in multi-select dropdown (<select multiple/>) not to process the empty/static options (<option/>), which were not added by ng-options expression. I basically removed that if condition to fix this bug. As far as the assumption goes, I am not sure if its valid & I would have expected test failures as the result of removing that check, which obviously didn't happen in this case.

And also, this plunkr - http://plnkr.co/edit/jDijgjJ0EZLFUGIkTKDs?p=preview proves the expected behavior after the fix.

Let me know if you have further questions.

Thanks!

@petebacondarwin
Copy link
Contributor

I suspect that this code you are removing was fixing some old IE bug.

@tbosch tbosch modified the milestones: 1.2.12, 1.2.11 Feb 3, 2014
tbosch pushed a commit to tbosch/angular.js that referenced this pull request Feb 6, 2014
…ions

Shows the static option for a not selected value in a select with
ngOption also when the multiple attribute is used.

Closes angular#4325
Closes angular#5938
@tbosch
Copy link
Contributor

tbosch commented Feb 6, 2014

Hi @siddii,
as I think over it, this does not make sense.

In a drop down box, you need an additional element to unselect a previously selected value.
However, in a multiple select, you are able to unselect any element by pressing Ctrl+Click (Windows) or Command+Click (Mac). This should work in any browser and is the default behavior of HTML.

So why do you need that additional entry, what is your use case?

@tbosch tbosch modified the milestones: Purgatory, 1.2.12 Feb 6, 2014
@tbosch tbosch assigned tbosch and unassigned tbosch Feb 6, 2014
@tbosch
Copy link
Contributor

tbosch commented Feb 6, 2014

Closing this for now. Please comment if you have a usecase that I overlooked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<select multiple ng-options> do not support default/empty option
5 participants