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

Commit 8bca6f4

Browse files
committed
Merge branch 'mareczek-master'
2 parents 5283c71 + 4d31e8c commit 8bca6f4

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/uiSelectController.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@ uis.controller('uiSelectCtrl',
491491

492492
var key = e.which;
493493

494+
if (~[KEY.ENTER,KEY.ESC].indexOf(key)){
495+
e.preventDefault();
496+
e.stopPropagation();
497+
}
498+
494499
// if(~[KEY.ESC,KEY.TAB].indexOf(key)){
495500
// //TODO: SEGURO?
496501
// ctrl.close();

src/uiSelectMultipleDirective.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
99
$select = $scope.$select,
1010
ngModel;
1111

12-
//Wait for link fn to inject it
12+
if (angular.isUndefined($select.selected))
13+
$select.selected = [];
14+
15+
//Wait for link fn to inject it
1316
$scope.$evalAsync(function(){ ngModel = $scope.ngModel; });
1417

1518
ctrl.activeMatchIndex = -1;
@@ -21,7 +24,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
2124

2225
ctrl.refreshComponent = function(){
2326
//Remove already selected items
24-
//e.g. When user clicks on a selection, the selected array changes and
27+
//e.g. When user clicks on a selection, the selected array changes and
2528
//the dropdown should remove that item
2629
$select.refreshItems();
2730
$select.sizeSearchInput();
@@ -123,7 +126,7 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
123126
};
124127
if (!inputValue) return resultMultiple; //If ngModel was undefined
125128
for (var k = inputValue.length - 1; k >= 0; k--) {
126-
//Check model array of currently selected items
129+
//Check model array of currently selected items
127130
if (!checkFnMultiple($select.selected, inputValue[k])){
128131
//Check model array of all items available
129132
if (!checkFnMultiple(data, inputValue[k])){
@@ -134,8 +137,8 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
134137
}
135138
return resultMultiple;
136139
});
137-
138-
//Watch for external model changes
140+
141+
//Watch for external model changes
139142
scope.$watchCollection(function(){ return ngModel.$modelValue; }, function(newValue, oldValue) {
140143
if (oldValue != newValue){
141144
ngModel.$modelValue = null; //Force scope model value and ngModel value to be out of sync to re-run formatters

0 commit comments

Comments
 (0)