@@ -23,10 +23,10 @@ import {
23
23
import {
24
24
CdkConnectedOverlay ,
25
25
Overlay ,
26
+ RepositionScrollStrategy ,
26
27
ScrollStrategy ,
27
28
ViewportRuler ,
28
29
} from '@angular/cdk/overlay' ;
29
- import { filter , take , map , switchMap , takeUntil , startWith } from 'rxjs/operators' ;
30
30
import {
31
31
AfterContentInit ,
32
32
Attribute ,
@@ -40,7 +40,6 @@ import {
40
40
ElementRef ,
41
41
EventEmitter ,
42
42
Inject ,
43
- inject ,
44
43
InjectionToken ,
45
44
Input ,
46
45
isDevMode ,
@@ -75,7 +74,8 @@ import {
75
74
mixinTabIndex ,
76
75
} from '@angular/material/core' ;
77
76
import { 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' ;
79
79
import { matSelectAnimations } from './select-animations' ;
80
80
import {
81
81
getMatSelectDynamicMultipleError ,
@@ -122,13 +122,20 @@ export const SELECT_PANEL_VIEWPORT_PADDING = 8;
122
122
123
123
/** Injection token that determines the scroll handling while a select is open. */
124
124
export 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
+ } ;
132
139
133
140
/** Change event object that is emitted when the select value has changed. */
134
141
export class MatSelectChange {
0 commit comments