From 3281c19131650c6f7c22ec5b7fb348a58e6aab73 Mon Sep 17 00:00:00 2001 From: Hugh Anderson Date: Fri, 1 Jul 2016 11:25:53 -0400 Subject: [PATCH] allow processing to continue when clearing with tagging Fixes [#1695](https://github.com/angular-ui/ui-select/issues/1695) --- dist/select.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dist/select.js b/dist/select.js index afbd4350b..f5a88ab08 100644 --- a/dist/select.js +++ b/dist/select.js @@ -632,17 +632,17 @@ uis.controller('uiSelectCtrl', if ( ctrl.activeIndex === 0 ) { // ctrl.tagging pushes items to ctrl.items, so we only have empty val // for `item` if it is a detected duplicate - if ( item === undefined ) return; - - // create new item on the fly if we don't already have one; - // use tagging function if we have one - if ( ctrl.tagging.fct !== undefined && typeof item === 'string' ) { - item = ctrl.tagging.fct(item); - if (!item) return; - // if item type is 'string', apply the tagging label - } else if ( typeof item === 'string' ) { - // trim the trailing space - item = item.replace(ctrl.taggingLabel,'').trim(); + if ( item !== undefined ) { + // create new item on the fly if we don't already have one; + // use tagging function if we have one + if ( ctrl.tagging.fct !== undefined && typeof item === 'string' ) { + item = ctrl.tagging.fct(item); + if (!item) return; + // if item type is 'string', apply the tagging label + } else if ( typeof item === 'string' ) { + // trim the trailing space + item = item.replace(ctrl.taggingLabel,'').trim(); + } } } } @@ -2245,4 +2245,4 @@ $templateCache.put("select2/select-multiple.tpl.html","
"); $templateCache.put("selectize/choices.tpl.html","
"); $templateCache.put("selectize/match.tpl.html","
"); -$templateCache.put("selectize/select.tpl.html","
");}]); \ No newline at end of file +$templateCache.put("selectize/select.tpl.html","
");}]);