@@ -350,10 +350,12 @@ uis.controller('uiSelectCtrl',
350
350
351
351
if ( ! item || ! item . _uiSelectChoiceDisabled ) {
352
352
if ( ctrl . tagging . isActivated ) {
353
- // if taggingLabel is disabled, we pull from ctrl.search val
353
+ // if taggingLabel is disabled and item is undefined we pull from ctrl.search
354
354
if ( ctrl . taggingLabel === false ) {
355
355
if ( ctrl . activeIndex < 0 ) {
356
- item = ctrl . tagging . fct !== undefined ? ctrl . tagging . fct ( ctrl . search ) : ctrl . search ;
356
+ if ( item === undefined ) {
357
+ item = ctrl . tagging . fct !== undefined ? ctrl . tagging . fct ( ctrl . search ) : ctrl . search ;
358
+ }
357
359
if ( ! item || angular . equals ( ctrl . items [ 0 ] , item ) ) {
358
360
return ;
359
361
}
@@ -606,18 +608,16 @@ uis.controller('uiSelectCtrl',
606
608
if ( items . length === 0 ) {
607
609
items = [ data ] ;
608
610
}
609
- if ( items . length > 0 ) {
610
611
var oldsearch = ctrl . search ;
611
- angular . forEach ( items , function ( item ) {
612
- var newItem = ctrl . tagging . fct ? ctrl . tagging . fct ( item ) : item ;
613
- if ( newItem ) {
614
- ctrl . select ( newItem , true ) ;
615
- }
616
- } ) ;
617
- ctrl . search = oldsearch || EMPTY_SEARCH ;
618
- e . preventDefault ( ) ;
619
- e . stopPropagation ( ) ;
620
- }
612
+ angular . forEach ( items , function ( item ) {
613
+ var newItem = ctrl . tagging . fct ? ctrl . tagging . fct ( item ) : item ;
614
+ if ( newItem ) {
615
+ ctrl . select ( newItem , true ) ;
616
+ }
617
+ } ) ;
618
+ ctrl . search = oldsearch || EMPTY_SEARCH ;
619
+ e . preventDefault ( ) ;
620
+ e . stopPropagation ( ) ;
621
621
} else if ( ctrl . paste ) {
622
622
ctrl . paste ( data ) ;
623
623
ctrl . search = EMPTY_SEARCH ;
0 commit comments