@@ -566,7 +566,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
566566 * Sets the selected option based on a value. If no option can be
567567 * found with the designated value, the select trigger is cleared.
568568 */
569- private _setSelectionByValue ( value : any | any [ ] ) : void {
569+ private _setSelectionByValue ( value : any | any [ ] , isUserInput = false ) : void {
570570 const isArray = Array . isArray ( value ) ;
571571
572572 if ( this . multiple && value && ! isArray ) {
@@ -576,10 +576,10 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
576576 this . _clearSelection ( ) ;
577577
578578 if ( isArray ) {
579- value . forEach ( ( currentValue : any ) => this . _selectValue ( currentValue ) ) ;
579+ value . forEach ( ( currentValue : any ) => this . _selectValue ( currentValue , isUserInput ) ) ;
580580 this . _sortValues ( ) ;
581581 } else {
582- this . _selectValue ( value ) ;
582+ this . _selectValue ( value , isUserInput ) ;
583583 }
584584
585585 this . _setValueWidth ( ) ;
@@ -595,14 +595,14 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
595595 * Finds and selects and option based on its value.
596596 * @returns Option that has the corresponding value.
597597 */
598- private _selectValue ( value : any ) : MdOption {
598+ private _selectValue ( value : any , isUserInput = false ) : MdOption {
599599 let optionsArray = this . options . toArray ( ) ;
600600 let correspondingOption = optionsArray . find ( option => {
601601 return option . value != null && option . value === value ;
602602 } ) ;
603603
604604 if ( correspondingOption ) {
605- correspondingOption . select ( ) ;
605+ isUserInput ? correspondingOption . _selectViaInteraction ( ) : correspondingOption . select ( ) ;
606606 this . _selectionModel . select ( correspondingOption ) ;
607607 this . _keyManager . setActiveItem ( optionsArray . indexOf ( correspondingOption ) ) ;
608608 }
@@ -1027,7 +1027,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
10271027
10281028 if ( currentActiveItem !== prevActiveItem ) {
10291029 this . _clearSelection ( ) ;
1030- this . _setSelectionByValue ( currentActiveItem . value ) ;
1030+ this . _setSelectionByValue ( currentActiveItem . value , true ) ;
10311031 this . _propagateChanges ( ) ;
10321032 }
10331033 }
0 commit comments