@@ -82,7 +82,7 @@ import {
82
82
MatOptionSelectionChange ,
83
83
} from '../core' ;
84
84
import { 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' ;
86
86
import { filter , map , startWith , switchMap , take , takeUntil } from 'rxjs/operators' ;
87
87
import {
88
88
getMatSelectDynamicMultipleError ,
@@ -734,6 +734,8 @@ export class MatSelect
734
734
this . panelOpen ? this . close ( ) : this . open ( ) ;
735
735
}
736
736
737
+ _positionChangeSubscription : Subscription ;
738
+
737
739
/** Opens the overlay panel. */
738
740
open ( ) : void {
739
741
if ( ! this . _canOpen ( ) ) {
@@ -751,10 +753,17 @@ export class MatSelect
751
753
this . _overlayWidth = this . _getOverlayWidth ( this . _preferredOverlayOrigin ) ;
752
754
this . _applyModalPanelOwnership ( ) ;
753
755
this . _panelOpen = true ;
754
- this . _overlayDir . positionChange . pipe ( take ( 1 ) ) . subscribe ( ( ) => {
756
+ this . _overlayDir . positionChange . pipe ( take ( 1 ) ) . subscribe ( arg => {
755
757
this . _changeDetectorRef . detectChanges ( ) ;
756
758
this . _positioningSettled ( ) ;
757
759
} ) ;
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
+ } ) ;
758
767
this . _overlayDir . attachOverlay ( ) ;
759
768
this . _keyManager . withHorizontalOrientation ( null ) ;
760
769
this . _highlightCorrectOption ( ) ;
0 commit comments