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 1002
1002
return false ;
1003
1003
} ;
1004
1004
if ( ! inputValue ) return resultMultiple ; //If ngModel was undefined
1005
+ if ( $select . tagging . isActivated ) return inputValue ; // If tagging is enabled, preserve model values
1005
1006
for ( var k = inputValue . length - 1 ; k >= 0 ; k -- ) {
1006
1007
if ( ! checkFnMultiple ( $select . selected , inputValue [ k ] ) ) {
1007
1008
checkFnMultiple ( data , inputValue [ k ] ) ;
Original file line number Diff line number Diff line change @@ -1653,6 +1653,26 @@ describe('ui-select tests', function() {
1653
1653
1654
1654
expect ( el . scope ( ) . $select . multiple ) . toBe ( true ) ;
1655
1655
} ) ;
1656
+
1657
+ it ( 'should preserve the model if tagging is enabled on select multiple' , function ( ) {
1658
+ scope . selection . selectedMultiple = [ "I am not on the list of choices" ] ;
1659
+
1660
+ var el = compileTemplate (
1661
+ '<ui-select multiple="multiple" tagging ng-model="selection.selectedMultiple" theme="bootstrap" style="width: 800px;"> \
1662
+ <ui-select-match placeholder="Pick one...">{{$item.name}} <{{$item.email}}></ui-select-match> \
1663
+ <ui-select-choices repeat="person.email as person in people | filter: $select.search"> \
1664
+ <div ng-bind-html="person.name | highlight: $select.search"></div> \
1665
+ <div ng-bind-html="person.email | highlight: $select.search"></div> \
1666
+ </ui-select-choices> \
1667
+ </ui-select> \
1668
+ '
1669
+ ) ;
1670
+
1671
+ scope . $digest ( ) ;
1672
+
1673
+ expect ( scope . selection . selectedMultiple )
1674
+ . toEqual ( [ "I am not on the list of choices" ] ) ;
1675
+ } ) ;
1656
1676
1657
1677
it ( 'should allow paste tag from clipboard' , function ( ) {
1658
1678
scope . taggingFunc = function ( name ) {
You can’t perform that action at this time.
0 commit comments