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

Commit d95268c

Browse files
committed
fix(uiSelectController): fix empty array for multiple
Returns empty value if an empty array is used when in multiple mode Closes #335
1 parent 043059c commit d95268c

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

Diff for: dist/select.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.13.3 - 2016-01-25T23:01:33.538Z
4+
* Version: 0.14.0 - 2016-01-27T20:50:38.891Z
55
* License: MIT
66
*/
77

Diff for: dist/select.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* ui-select
33
* http://github.com/angular-ui/ui-select
4-
* Version: 0.13.3 - 2016-01-25T23:01:33.462Z
4+
* Version: 0.14.0 - 2016-01-27T20:50:38.779Z
55
* License: MIT
66
*/
77

@@ -306,7 +306,7 @@ uis.controller('uiSelectCtrl',
306306
}
307307

308308
ctrl.isEmpty = function() {
309-
return angular.isUndefined(ctrl.selected) || ctrl.selected === null || ctrl.selected === '';
309+
return angular.isUndefined(ctrl.selected) || ctrl.selected === null || ctrl.selected === '' || (ctrl.multiple && ctrl.selected.length === 0);
310310
};
311311

312312
// Most of the time the user does not want to empty the search input when in typeahead mode
@@ -1592,9 +1592,11 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
15921592
// handle the object tagging implementation
15931593
} else {
15941594
var mockObj = tempArr[i];
1595-
mockObj.isTag = true;
1595+
if (angular.isObject(mockObj)) {
1596+
mockObj.isTag = true;
1597+
}
15961598
if ( angular.equals(mockObj, needle) ) {
1597-
dupeIndex = i;
1599+
dupeIndex = i;
15981600
}
15991601
}
16001602
}

Diff for: dist/select.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/select.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/uiSelectController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ uis.controller('uiSelectCtrl',
5757
}
5858

5959
ctrl.isEmpty = function() {
60-
return angular.isUndefined(ctrl.selected) || ctrl.selected === null || ctrl.selected === '';
60+
return angular.isUndefined(ctrl.selected) || ctrl.selected === null || ctrl.selected === '' || (ctrl.multiple && ctrl.selected.length === 0);
6161
};
6262

6363
// Most of the time the user does not want to empty the search input when in typeahead mode

0 commit comments

Comments
 (0)