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

Commit 4b4e8b5

Browse files
committed
Protect against empty selection causing exception when getting placeholder
1 parent 948d383 commit 4b4e8b5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/uiSelectController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ uis.controller('uiSelectCtrl',
125125
data = data || ctrl.parserResult.source($scope);
126126
var selectedItems = ctrl.selected;
127127
//TODO should implement for single mode removeSelected
128-
if ((angular.isArray(selectedItems) && !selectedItems.length) || !ctrl.removeSelected) {
128+
if (ctrl.isEmpty() || (angular.isArray(selectedItems) && !selectedItems.length) || !ctrl.removeSelected) {
129129
ctrl.setItemsFn(data);
130130
}else{
131131
if ( data !== undefined ) {

src/uiSelectMultipleDirective.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
5656

5757
ctrl.getPlaceholder = function(){
5858
//Refactor single?
59-
if($select.selected.length) return;
59+
if($select.selected && $select.selected.length) return;
6060
return $select.placeholder;
6161
};
6262

0 commit comments

Comments
 (0)