Skip to content

Commit 2e9f71a

Browse files
committed
pfSelect - destroy the selectpicker when the directive is destroyed
Since patternfly 3.8, the structure of the HTML generated by the selectpicker has changed, and removing the original select element no longer necessarily removes the selectpicker div that's actually visible. This makes pf-select explicitly destroy the selectpicker when the element with that pf-select is going away. (Related to ManageIQ/manageiq#11893)
1 parent e98cb20 commit 2e9f71a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/select/select.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ angular.module('patternfly.select', []).directive('pfSelect', function ($timeout
8181
});
8282
};
8383

84+
var selectpickerDestroy = function () {
85+
element.selectpicker('destroy');
86+
};
87+
8488
element.selectpicker(scope.selectPickerOptions);
8589

8690
ngModel.$render = function () {
@@ -101,6 +105,8 @@ angular.module('patternfly.select', []).directive('pfSelect', function ($timeout
101105
}
102106

103107
attrs.$observe('disabled', selectpickerRefresh);
108+
109+
scope.$on('$destroy', selectpickerDestroy);
104110
}
105111
};
106112
});

0 commit comments

Comments
 (0)