Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

fix(uiSelect) support data-multiple attribute #1519

Merged
merged 1 commit into from
Mar 28, 2016

Conversation

user378230
Copy link
Contributor

uiSelectMatch was a special case where the non-normalised multiple attribute is checked, therefore using data-multiple resulted in the single select match template being loaded instead of the multiple-select-match template.

test is more involved than I would have liked but I couldn't see any other way to test it.

Closes #1451

@user378230 user378230 force-pushed the fix-data-attrs branch 2 times, most recently from 68c55dc to 7a45bf2 Compare March 23, 2016 22:21
@wesleycho
Copy link
Contributor

I'm not sure what your claimed support is, but here's a snippet in UI Bootstrap for what we check for: https://github.com/angular-ui/bootstrap/blob/master/src/tabs/tabs.js#L224-L234

@@ -10,7 +10,10 @@ uis.directive('uiSelectMatch', ['uiSelectConfig', function(uiSelectConfig) {

// Gets theme attribute from parent (ui-select)
var theme = tElement.parent().attr('theme') || uiSelectConfig.theme;
var multi = tElement.parent().attr('multiple');

var multi = angular.isDefined(tElement.parent().attr('multiple')) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably worth caching tElement.parent() above and rewriting to remove duplicate calls to .parent()

@user378230 user378230 force-pushed the fix-data-attrs branch 2 times, most recently from 23ce67e to 8359962 Compare March 28, 2016 02:18
uiSelectMatch was a special case where the non-normalised attribute
is checked, therefore using data-multiple resulted in the single
select match template being loaded.

Closes angular-ui#1451
@user378230
Copy link
Contributor Author

Yeah I was being somewhat lazy, updated if you get a chance to review. .

@wesleycho
Copy link
Contributor

LGTM

@user378230 user378230 merged commit 04eb3f6 into angular-ui:master Mar 28, 2016
radim-poloch added a commit to kirillbuga/ui-select that referenced this pull request Sep 17, 2016
kirillbuga pushed a commit to kirillbuga/ui-select that referenced this pull request Sep 20, 2016
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.

2 participants