File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 2323 if ( ! model ) {
2424 return ;
2525 }
26- var controlName = attrs [ "data-ig-control-name" ] , unbinder ;
26+ var controlName = attrs [ "data-ig-control-name" ] , unbinder , comboItems ;
2727 /**
2828 * Support both versions igCombo value methods before and after 15.1
2929 */
3636 }
3737 }
3838 function setControlValue ( value ) {
39+ comboItems = value ;
3940 if ( typeof value === "string" ) {
4041 // in case view value is changed from text field (default Array.toString representation is comma separated)
4142 value = value . split ( "," ) ;
6768 items = comboValue ( combo ) ;
6869 angular . copy ( newValue , newDataSource ) ;
6970 combo . _setOption ( "dataSource" , newDataSource ) ;
71+ //if the items were not in the old data source, use stored values
72+ items = items . length !== 0 ? items : comboItems ;
7073 combo . value ( items ) ;
7174 } , true ) ;
7275 markWatcher ( scope , controlName , attrs ) ;
Original file line number Diff line number Diff line change @@ -609,6 +609,13 @@ describe("my app", function() {
609609 expect ( browser . driver . sleep ( 250 ) ) . toBe ( undefined ) ; //util.getResult(combo + '.igCombo("option", "delayInputChangeProcessing");')
610610 expect ( util . getResult ( scope + ".combo.value1" ) ) . toBe ( 2 ) ;
611611 } ) ;
612+
613+ it ( "should update the ng-model when the data has been changed" , function ( ) {
614+ util . executeScript ( scope + ".northwind = [{'ProductID': 21, 'ProductName': 'Strawberry'}];" ) ;
615+ util . executeScript ( scope + ".combo.value2 = [21];" ) ;
616+ util . executeScript ( scope + ".$apply();" ) ;
617+ expect ( util . getResult ( '$("#combo2").val()' ) ) . toBe ( "Strawberry" ) ;
618+ } ) ;
612619 } ) ;
613620
614621 describe ( "HTML Editor" , function ( ) {
You can’t perform that action at this time.
0 commit comments