This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 201201
202202 ctrl . activeIndex = ctrl . activeIndex >= ctrl . items . length ? 0 : ctrl . activeIndex ;
203203
204+ // ensure that the index is set to zero for tagging variants
205+ // that where first option is auto-selected
206+ if ( ctrl . activeIndex === - 1 && ctrl . taggingLabel !== false ) {
207+ ctrl . activeIndex = 0 ;
208+ }
209+
204210 // Give it time to appear before focus
205211 $timeout ( function ( ) {
206212 ctrl . search = initSearchValue || ctrl . search ;
323329 var itemIndex = ctrl . items . indexOf ( itemScope [ ctrl . itemProperty ] ) ;
324330 var isActive = itemIndex === ctrl . activeIndex ;
325331
326- if ( ! isActive || itemIndex < 0 ) {
332+ if ( ! isActive || ( itemIndex < 0 && ctrl . taggingLabel !== false ) || ( itemIndex < 0 && ctrl . taggingLabel === false ) ) {
327333 return false ;
328334 }
335+
329336 if ( isActive && ! angular . isUndefined ( ctrl . onHighlightCallback ) ) {
330337 itemScope . $eval ( ctrl . onHighlightCallback ) ;
331338 }
332339
333- if ( ctrl . taggingLabel === false && ctrl . activeIndex === - 1 ) {
334- return false ;
335- }
336- return itemIndex === ctrl . activeIndex ;
340+ return isActive ;
337341 } ;
338342
339343 ctrl . isDisabled = function ( itemScope ) {
10141018 $select . taggingLabel = attrs . taggingLabel !== undefined ? attrs . taggingLabel : '(new)' ;
10151019 }
10161020 }
1021+ else
1022+ {
1023+ $select . taggingLabel = false ;
1024+ }
10171025 } ) ;
10181026
10191027 attrs . $observe ( 'taggingTokens' , function ( ) {
You can’t perform that action at this time.
0 commit comments