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

Commit e8be37c

Browse files
committed
appending ui-select-header and ui-select-footer as li items onto ul.ui-select-choices
1 parent 6d0a8f3 commit e8be37c

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

dist/select.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -965,11 +965,6 @@ uis.directive('uiSelect',
965965
// instead of creating a hackish DOM element:
966966
var transcluded = angular.element('<div>').append(clone);
967967

968-
var transcludedHeader = transcluded.querySelectorAll('.ui-select-header');
969-
transcludedHeader.removeAttr('ui-select-header'); //To avoid loop in case directive as attr
970-
transcludedHeader.removeAttr('data-ui-select-header'); // Properly handle HTML5 data-attributes
971-
element.querySelectorAll('.ui-select-header').replaceWith(transcludedHeader);
972-
973968
var transcludedMatch = transcluded.querySelectorAll('.ui-select-match');
974969
transcludedMatch.removeAttr('ui-select-match'); //To avoid loop in case directive as attr
975970
transcludedMatch.removeAttr('data-ui-select-match'); // Properly handle HTML5 data-attributes
@@ -986,10 +981,21 @@ uis.directive('uiSelect',
986981
}
987982
element.querySelectorAll('.ui-select-choices').replaceWith(transcludedChoices);
988983

984+
var transcludedHeader = transcluded.querySelectorAll('.ui-select-header');
985+
if(transcludedHeader && transcludedHeader.length){
986+
transcludedHeader.removeAttr('ui-select-header'); //To avoid loop in case directive as attr
987+
transcludedHeader.removeAttr('data-ui-select-header'); // Properly handle HTML5 data-attributes
988+
$timeout(function(){
989+
transcludedChoices.prepend(transcludedHeader);
990+
});
991+
}
992+
989993
var transcludedFooter = transcluded.querySelectorAll('.ui-select-footer');
990-
transcludedFooter.removeAttr('ui-select-footer'); //To avoid loop in case directive as attr
991-
transcludedFooter.removeAttr('data-ui-select-footer'); // Properly handle HTML5 data-attributes
992-
element.querySelectorAll('.ui-select-footer').replaceWith(transcludedFooter);
994+
if(transcludedFooter && transcludedFooter.length){
995+
transcludedFooter.removeAttr('ui-select-footer'); //To avoid loop in case directive as attr
996+
transcludedFooter.removeAttr('data-ui-select-footer'); // Properly handle HTML5 data-attributes
997+
transcludedChoices.append(transcludedFooter);
998+
}
993999
});
9941000

9951001
// Support for appending the select field to the body when its open
@@ -1848,15 +1854,15 @@ uis.directive('uiSelectSort', ['$timeout', 'uiSelectConfig', 'uiSelectMinErr', f
18481854

18491855
uis.directive('uiSelectHeader', function(){
18501856
return {
1851-
template: '<div class="ui-select-header" ng-transclude></div>',
1857+
template: '<li class="ui-select-header" ng-transclude></li>',
18521858
restrict: 'EA',
18531859
transclude: true,
18541860
replace: true
18551861
};
18561862
});
18571863
uis.directive('uiSelectFooter', function(){
18581864
return {
1859-
template: '<div class="ui-select-footer" ng-transclude></div>',
1865+
template: '<li class="ui-select-footer" ng-transclude></li>',
18601866
restrict: 'EA',
18611867
transclude: true,
18621868
replace: true

0 commit comments

Comments
 (0)