@@ -566,7 +566,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
566
566
* Sets the selected option based on a value. If no option can be
567
567
* found with the designated value, the select trigger is cleared.
568
568
*/
569
- private _setSelectionByValue ( value : any | any [ ] ) : void {
569
+ private _setSelectionByValue ( value : any | any [ ] , isUserInput = false ) : void {
570
570
const isArray = Array . isArray ( value ) ;
571
571
572
572
if ( this . multiple && value && ! isArray ) {
@@ -576,10 +576,10 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
576
576
this . _clearSelection ( ) ;
577
577
578
578
if ( isArray ) {
579
- value . forEach ( ( currentValue : any ) => this . _selectValue ( currentValue ) ) ;
579
+ value . forEach ( ( currentValue : any ) => this . _selectValue ( currentValue , isUserInput ) ) ;
580
580
this . _sortValues ( ) ;
581
581
} else {
582
- this . _selectValue ( value ) ;
582
+ this . _selectValue ( value , isUserInput ) ;
583
583
}
584
584
585
585
this . _setValueWidth ( ) ;
@@ -595,14 +595,14 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
595
595
* Finds and selects and option based on its value.
596
596
* @returns Option that has the corresponding value.
597
597
*/
598
- private _selectValue ( value : any ) : MdOption {
598
+ private _selectValue ( value : any , isUserInput = false ) : MdOption {
599
599
let optionsArray = this . options . toArray ( ) ;
600
600
let correspondingOption = optionsArray . find ( option => {
601
601
return option . value != null && option . value === value ;
602
602
} ) ;
603
603
604
604
if ( correspondingOption ) {
605
- correspondingOption . select ( ) ;
605
+ isUserInput ? correspondingOption . _selectViaInteraction ( ) : correspondingOption . select ( ) ;
606
606
this . _selectionModel . select ( correspondingOption ) ;
607
607
this . _keyManager . setActiveItem ( optionsArray . indexOf ( correspondingOption ) ) ;
608
608
}
@@ -1027,7 +1027,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
1027
1027
1028
1028
if ( currentActiveItem !== prevActiveItem ) {
1029
1029
this . _clearSelection ( ) ;
1030
- this . _setSelectionByValue ( currentActiveItem . value ) ;
1030
+ this . _setSelectionByValue ( currentActiveItem . value , true ) ;
1031
1031
this . _propagateChanges ( ) ;
1032
1032
}
1033
1033
}
0 commit comments