This repository was archived by the owner on Oct 2, 2019. It is now read-only.
Commit 5d8fb7e Brian Feister
committed
1 parent e417d20 commit 5d8fb7e Copy full SHA for 5d8fb7e
File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 201
201
202
202
ctrl . activeIndex = ctrl . activeIndex >= ctrl . items . length ? 0 : ctrl . activeIndex ;
203
203
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
+
204
210
// Give it time to appear before focus
205
211
$timeout ( function ( ) {
206
212
ctrl . search = initSearchValue || ctrl . search ;
323
329
var itemIndex = ctrl . items . indexOf ( itemScope [ ctrl . itemProperty ] ) ;
324
330
var isActive = itemIndex === ctrl . activeIndex ;
325
331
326
- if ( ! isActive || itemIndex < 0 ) {
332
+ if ( ! isActive || ( itemIndex < 0 && ctrl . taggingLabel !== false ) || ( itemIndex < 0 && ctrl . taggingLabel === false ) ) {
327
333
return false ;
328
334
}
335
+
329
336
if ( isActive && ! angular . isUndefined ( ctrl . onHighlightCallback ) ) {
330
337
itemScope . $eval ( ctrl . onHighlightCallback ) ;
331
338
}
332
339
333
- if ( ctrl . taggingLabel === false && ctrl . activeIndex === - 1 ) {
334
- return false ;
335
- }
336
- return itemIndex === ctrl . activeIndex ;
340
+ return isActive ;
337
341
} ;
338
342
339
343
ctrl . isDisabled = function ( itemScope ) {
1014
1018
$select . taggingLabel = attrs . taggingLabel !== undefined ? attrs . taggingLabel : '(new)' ;
1015
1019
}
1016
1020
}
1021
+ else
1022
+ {
1023
+ $select . taggingLabel = false ;
1024
+ }
1017
1025
} ) ;
1018
1026
1019
1027
attrs . $observe ( 'taggingTokens' , function ( ) {
You can’t perform that action at this time.
0 commit comments