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

Commit c306275

Browse files
author
Brian Feister
committed
Ensure a default setting for taggingTokens.isActivated is explicitly disabled, and allow _resetSearchInput to execute any time tagging is enabled
1 parent c6dcd05 commit c306275

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/select.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
ctrl.multiple = false; // Initialized inside uiSelect directive link function
165165
ctrl.disableChoiceExpression = undefined; // Initialized inside uiSelect directive link function
166166
ctrl.$filter = $filter;
167+
ctrl.taggingTokens = {isActivated: false, tokens: undefined};
167168

168169
ctrl.isEmpty = function() {
169170
return angular.isUndefined(ctrl.selected) || ctrl.selected === null || ctrl.selected === '';
@@ -176,7 +177,7 @@
176177

177178
// Most of the time the user does not want to empty the search input when in typeahead mode
178179
function _resetSearchInput() {
179-
if (ctrl.resetSearchInput) {
180+
if (ctrl.resetSearchInput || ctrl.tagging.isActivated ) {
180181
ctrl.search = EMPTY_SEARCH;
181182
//reset activeIndex
182183
if (ctrl.selected && ctrl.items.length && !ctrl.multiple) {
@@ -970,21 +971,18 @@
970971
// associated with tagging
971972
if ( attrs.taggingLabel === 'false' ) {
972973
$select.taggingLabel = false;
973-
} else {
974+
}
975+
else
976+
{
974977
$select.taggingLabel = attrs.taggingLabel !== undefined ? attrs.taggingLabel : '(new)';
975978
}
976979
}
977980
});
978981

979982
attrs.$observe('taggingTokens', function() {
980-
if(attrs.tagging !== undefined && attrs.taggingTokens !== undefined)
981-
{
982-
var tokens = attrs.taggingTokens !== undefined ? attrs.taggingTokens.split('|') : [','];
983-
$select.taggingTokens = {isActivated: true, tokens: tokens };
984-
}
985-
else
986-
{
987-
$select.taggingTokens = {isActivated: false, tokens: undefined};
983+
if (attrs.tagging !== undefined) {
984+
var tokens = attrs.taggingTokens !== undefined ? attrs.taggingTokens.split('|') : [',','ENTER'];
985+
$select.taggingTokens = {isActivated: true, tokens: tokens };
988986
}
989987
});
990988

0 commit comments

Comments
 (0)