File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1004
1004
return false ;
1005
1005
} ;
1006
1006
if ( ! inputValue ) return resultMultiple ; //If ngModel was undefined
1007
+ if ( $select . tagging . isActivated ) return inputValue ; // If tagging is enabled, preserve model values
1007
1008
for ( var k = inputValue . length - 1 ; k >= 0 ; k -- ) {
1008
1009
if ( ! checkFnMultiple ( $select . selected , inputValue [ k ] ) ) {
1009
1010
checkFnMultiple ( data , inputValue [ k ] ) ;
Original file line number Diff line number Diff line change @@ -1668,6 +1668,26 @@ describe('ui-select tests', function() {
1668
1668
1669
1669
expect ( el . scope ( ) . $select . multiple ) . toBe ( true ) ;
1670
1670
} ) ;
1671
+
1672
+ it ( 'should preserve the model if tagging is enabled on select multiple' , function ( ) {
1673
+ scope . selection . selectedMultiple = [ "I am not on the list of choices" ] ;
1674
+
1675
+ var el = compileTemplate (
1676
+ '<ui-select multiple="multiple" tagging ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
1677
+ <ui-select-match placeholder="Pick one...">{{$item.name}} <{{$item.email}}></ui-select-match> \
1678
+ <ui-select-choices repeat="person.email as person in people | filter: $select.search"> \
1679
+ <div ng-bind-html="person.name | highlight: $select.search"></div> \
1680
+ <div ng-bind-html="person.email | highlight: $select.search"></div> \
1681
+ </ui-select-choices> \
1682
+ </ui-select> \
1683
+ '
1684
+ ) ;
1685
+
1686
+ scope . $digest ( ) ;
1687
+
1688
+ expect ( scope . selection . selectedMultiple )
1689
+ . toEqual ( [ "I am not on the list of choices" ] ) ;
1690
+ } ) ;
1671
1691
1672
1692
it ( 'should allow paste tag from clipboard' , function ( ) {
1673
1693
scope . taggingFunc = function ( name ) {
You can’t perform that action at this time.
0 commit comments