6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
import { Directionality } from '@angular/cdk/bidi' ;
9
- import { DOWN_ARROW , ENTER , ESCAPE , UP_ARROW , TAB } from '@angular/cdk/keycodes' ;
9
+ import { DOWN_ARROW , ENTER , ESCAPE , TAB , UP_ARROW } from '@angular/cdk/keycodes' ;
10
10
import {
11
11
FlexibleConnectedPositionStrategy ,
12
12
Overlay ,
13
- OverlayRef ,
14
13
OverlayConfig ,
14
+ OverlayRef ,
15
15
PositionStrategy ,
16
16
ScrollStrategy ,
17
17
} from '@angular/cdk/overlay' ;
18
18
import { TemplatePortal } from '@angular/cdk/portal' ;
19
- import { filter } from 'rxjs/operators/filter' ;
20
- import { take } from 'rxjs/operators/take' ;
21
- import { switchMap } from 'rxjs/operators/switchMap' ;
22
- import { tap } from 'rxjs/operators/tap' ;
23
- import { delay } from 'rxjs/operators/delay' ;
19
+ import { DOCUMENT } from '@angular/common' ;
24
20
import {
25
21
ChangeDetectorRef ,
26
22
Directive ,
27
23
ElementRef ,
28
24
forwardRef ,
29
25
Host ,
30
26
Inject ,
27
+ inject ,
31
28
InjectionToken ,
32
29
Input ,
33
30
NgZone ,
@@ -37,19 +34,23 @@ import {
37
34
} from '@angular/core' ;
38
35
import { ControlValueAccessor , NG_VALUE_ACCESSOR } from '@angular/forms' ;
39
36
import {
37
+ _countGroupLabelsBeforeOption ,
38
+ _getOptionScrollPosition ,
40
39
MatOption ,
41
40
MatOptionSelectionChange ,
42
- _getOptionScrollPosition ,
43
- _countGroupLabelsBeforeOption ,
44
41
} from '@angular/material/core' ;
45
42
import { MatFormField } from '@angular/material/form-field' ;
46
- import { DOCUMENT } from '@angular/common' ;
47
43
import { Observable } from 'rxjs/Observable' ;
48
- import { Subject } from 'rxjs/Subject' ;
49
44
import { defer } from 'rxjs/observable/defer' ;
50
45
import { fromEvent } from 'rxjs/observable/fromEvent' ;
51
46
import { merge } from 'rxjs/observable/merge' ;
52
47
import { of as observableOf } from 'rxjs/observable/of' ;
48
+ import { delay } from 'rxjs/operators/delay' ;
49
+ import { filter } from 'rxjs/operators/filter' ;
50
+ import { switchMap } from 'rxjs/operators/switchMap' ;
51
+ import { take } from 'rxjs/operators/take' ;
52
+ import { tap } from 'rxjs/operators/tap' ;
53
+ import { Subject } from 'rxjs/Subject' ;
53
54
import { Subscription } from 'rxjs/Subscription' ;
54
55
import { MatAutocomplete } from './autocomplete' ;
55
56
@@ -68,20 +69,13 @@ export const AUTOCOMPLETE_PANEL_HEIGHT = 256;
68
69
69
70
/** Injection token that determines the scroll handling while the autocomplete panel is open. */
70
71
export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY =
71
- new InjectionToken < ( ) => ScrollStrategy > ( 'mat-autocomplete-scroll-strategy' ) ;
72
-
73
- /** @docs -private */
74
- export function MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER_FACTORY ( overlay : Overlay ) :
75
- ( ) => ScrollStrategy {
76
- return ( ) => overlay . scrollStrategies . reposition ( ) ;
77
- }
78
-
79
- /** @docs -private */
80
- export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER = {
81
- provide : MAT_AUTOCOMPLETE_SCROLL_STRATEGY ,
82
- deps : [ Overlay ] ,
83
- useFactory : MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER_FACTORY ,
84
- } ;
72
+ new InjectionToken < ( ) => ScrollStrategy > ( 'mat-autocomplete-scroll-strategy' , {
73
+ providedIn : 'root' ,
74
+ factory : ( ) => {
75
+ const overlay = inject ( Overlay ) ;
76
+ return ( ) => overlay . scrollStrategies . reposition ( ) ;
77
+ }
78
+ } ) ;
85
79
86
80
/**
87
81
* Provider that allows the autocomplete to register as a ControlValueAccessor.
0 commit comments