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

Protect against empty selection causing exception when getting placeHolder #956

Merged
merged 3 commits into from
Aug 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uiSelectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ uis.controller('uiSelectCtrl',
data = data || ctrl.parserResult.source($scope);
var selectedItems = ctrl.selected;
//TODO should implement for single mode removeSelected
if ((angular.isArray(selectedItems) && !selectedItems.length) || !ctrl.removeSelected) {
if (ctrl.isEmpty() || (angular.isArray(selectedItems) && !selectedItems.length) || !ctrl.removeSelected) {
ctrl.setItemsFn(data);
}else{
if ( data !== undefined ) {
Expand Down
2 changes: 1 addition & 1 deletion src/uiSelectMultipleDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec

ctrl.getPlaceholder = function(){
//Refactor single?
if($select.selected.length) return;
if($select.selected && $select.selected.length) return;
return $select.placeholder;
};

Expand Down