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

Commit fb637a9

Browse files
committed
Support multiple="multiple" attribute.
Some html preprocessors will transform <ui-select multiple></ui-select> into <ui-select multiple="multiple"></ui-select> which is currently not supported by angular-ui-select. This patch fixes the issue.
1 parent 9dec776 commit fb637a9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/select.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@
632632

633633
$select.multiple = angular.isDefined(attrs.multiple) && (
634634
attrs.multiple === '' ||
635+
attrs.multiple.toLowerCase() === 'multiple' ||
635636
attrs.multiple.toLowerCase() === 'true'
636637
);
637638

test/select.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,22 @@ describe('ui-select tests', function() {
15201520
.toBe("Wladimir <wladimir@email.com>Samantha <samantha@email.com>Nicole <nicole@email.com>");
15211521

15221522
});
1523+
1524+
it('should support multiple="multiple" attribute', function() {
1525+
1526+
var el = compileTemplate(
1527+
'<ui-select multiple="multiple" ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
1528+
<ui-select-match placeholder="Pick one...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match> \
1529+
<ui-select-choices repeat="person.email as person in people | filter: $select.search"> \
1530+
<div ng-bind-html="person.name | highlight: $select.search"></div> \
1531+
<div ng-bind-html="person.email | highlight: $select.search"></div> \
1532+
</ui-select-choices> \
1533+
</ui-select> \
1534+
'
1535+
);
1536+
1537+
expect(el.scope().$select.multiple).toBe(true);
1538+
});
15231539
});
15241540

15251541
describe('default configuration via uiSelectConfig', function() {

0 commit comments

Comments
 (0)