Skip to content

Commit 6f87765

Browse files
author
Alex Knowles
committed
add input id to search <input> if present on ui-select directive as input-id
1 parent f5260ea commit 6f87765

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/uiSelectDirective.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ uis.directive('uiSelect',
1919

2020
//Multiple or Single depending if multiple attribute presence
2121
if (angular.isDefined(tAttrs.multiple))
22-
tElement.append("<ui-select-multiple/>").removeAttr('multiple');
22+
tElement.append('<ui-select-multiple/>').removeAttr('multiple');
2323
else
24-
tElement.append("<ui-select-single/>");
24+
tElement.append('<ui-select-single/>');
25+
26+
if (tAttrs.inputId)
27+
tElement.querySelectorAll('input.ui-select-search')[0].id = tAttrs.inputId;
2528

2629
return function(scope, element, attrs, ctrls, transcludeFn) {
2730

@@ -43,7 +46,7 @@ uis.directive('uiSelect',
4346

4447
$select.onSelectCallback = $parse(attrs.onSelect);
4548
$select.onRemoveCallback = $parse(attrs.onRemove);
46-
49+
4750
//Limit the number of selections allowed
4851
$select.limit = (angular.isDefined(attrs.limit)) ? parseInt(attrs.limit, 10) : undefined;
4952

@@ -56,8 +59,8 @@ uis.directive('uiSelect',
5659

5760
if(attrs.tabindex){
5861
attrs.$observe('tabindex', function(value) {
59-
$select.focusInput.attr("tabindex", value);
60-
element.removeAttr("tabindex");
62+
$select.focusInput.attr('tabindex', value);
63+
element.removeAttr('tabindex');
6164
});
6265
}
6366

0 commit comments

Comments
 (0)