@@ -23,10 +23,10 @@ import {
2323import {
2424 CdkConnectedOverlay ,
2525 Overlay ,
26+ RepositionScrollStrategy ,
2627 ScrollStrategy ,
2728 ViewportRuler ,
2829} from '@angular/cdk/overlay' ;
29- import { filter , take , map , switchMap , takeUntil , startWith } from 'rxjs/operators' ;
3030import {
3131 AfterContentInit ,
3232 Attribute ,
@@ -40,7 +40,6 @@ import {
4040 ElementRef ,
4141 EventEmitter ,
4242 Inject ,
43- inject ,
4443 InjectionToken ,
4544 Input ,
4645 isDevMode ,
@@ -75,7 +74,8 @@ import {
7574 mixinTabIndex ,
7675} from '@angular/material/core' ;
7776import { MatFormField , MatFormFieldControl } from '@angular/material/form-field' ;
78- import { defer , Subject , merge , Observable } from 'rxjs' ;
77+ import { defer , merge , Observable , Subject } from 'rxjs' ;
78+ import { filter , map , startWith , switchMap , take , takeUntil } from 'rxjs/operators' ;
7979import { matSelectAnimations } from './select-animations' ;
8080import {
8181 getMatSelectDynamicMultipleError ,
@@ -122,13 +122,20 @@ export const SELECT_PANEL_VIEWPORT_PADDING = 8;
122122
123123/** Injection token that determines the scroll handling while a select is open. */
124124export const MAT_SELECT_SCROLL_STRATEGY =
125- new InjectionToken < ( ) => ScrollStrategy > ( 'mat-select-scroll-strategy' , {
126- providedIn : 'root' ,
127- factory : ( ) => {
128- const overlay = inject ( Overlay ) ;
129- return ( ) => overlay . scrollStrategies . reposition ( ) ;
130- }
131- } ) ;
125+ new InjectionToken < ( ) => ScrollStrategy > ( 'mat-select-scroll-strategy' ) ;
126+
127+ /** @docs -private */
128+ export function MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY ( overlay : Overlay ) :
129+ ( ) => RepositionScrollStrategy {
130+ return ( ) => overlay . scrollStrategies . reposition ( ) ;
131+ }
132+
133+ /** @docs -private */
134+ export const MAT_SELECT_SCROLL_STRATEGY_PROVIDER = {
135+ provide : MAT_SELECT_SCROLL_STRATEGY ,
136+ deps : [ Overlay ] ,
137+ useFactory : MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY ,
138+ } ;
132139
133140/** Change event object that is emitted when the select value has changed. */
134141export class MatSelectChange {
0 commit comments