@@ -82,7 +82,7 @@ import {
8282 MatOptionSelectionChange ,
8383} from '../core' ;
8484import { MAT_FORM_FIELD , MatFormField , MatFormFieldControl } from '../form-field' ;
85- import { defer , merge , Observable , Subject } from 'rxjs' ;
85+ import { defer , merge , Observable , Subject , Subscription } from 'rxjs' ;
8686import { filter , map , startWith , switchMap , take , takeUntil } from 'rxjs/operators' ;
8787import {
8888 getMatSelectDynamicMultipleError ,
@@ -734,6 +734,8 @@ export class MatSelect
734734 this . panelOpen ? this . close ( ) : this . open ( ) ;
735735 }
736736
737+ _positionChangeSubscription : Subscription ;
738+
737739 /** Opens the overlay panel. */
738740 open ( ) : void {
739741 if ( ! this . _canOpen ( ) ) {
@@ -751,10 +753,17 @@ export class MatSelect
751753 this . _overlayWidth = this . _getOverlayWidth ( this . _preferredOverlayOrigin ) ;
752754 this . _applyModalPanelOwnership ( ) ;
753755 this . _panelOpen = true ;
754- this . _overlayDir . positionChange . pipe ( take ( 1 ) ) . subscribe ( ( ) => {
756+ this . _overlayDir . positionChange . pipe ( take ( 1 ) ) . subscribe ( arg => {
755757 this . _changeDetectorRef . detectChanges ( ) ;
756758 this . _positioningSettled ( ) ;
757759 } ) ;
760+ if ( this . _positionChangeSubscription ) {
761+ this . _positionChangeSubscription . unsubscribe ( ) ;
762+ }
763+ this . _positionChangeSubscription = this . _overlayDir . positionChange . subscribe ( change => {
764+ // debugger;
765+ console . log ( this . _overlayDir ) ;
766+ } ) ;
758767 this . _overlayDir . attachOverlay ( ) ;
759768 this . _keyManager . withHorizontalOrientation ( null ) ;
760769 this . _highlightCorrectOption ( ) ;
0 commit comments