66 * found in the LICENSE file at https://angular.io/license
77 */
88import { 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' ;
1010import {
1111 FlexibleConnectedPositionStrategy ,
1212 Overlay ,
13- OverlayRef ,
1413 OverlayConfig ,
14+ OverlayRef ,
1515 PositionStrategy ,
1616 ScrollStrategy ,
1717} from '@angular/cdk/overlay' ;
1818import { 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' ;
2420import {
2521 ChangeDetectorRef ,
2622 Directive ,
2723 ElementRef ,
2824 forwardRef ,
2925 Host ,
3026 Inject ,
27+ inject ,
3128 InjectionToken ,
3229 Input ,
3330 NgZone ,
@@ -37,19 +34,23 @@ import {
3734} from '@angular/core' ;
3835import { ControlValueAccessor , NG_VALUE_ACCESSOR } from '@angular/forms' ;
3936import {
37+ _countGroupLabelsBeforeOption ,
38+ _getOptionScrollPosition ,
4039 MatOption ,
4140 MatOptionSelectionChange ,
42- _getOptionScrollPosition ,
43- _countGroupLabelsBeforeOption ,
4441} from '@angular/material/core' ;
4542import { MatFormField } from '@angular/material/form-field' ;
46- import { DOCUMENT } from '@angular/common' ;
4743import { Observable } from 'rxjs/Observable' ;
48- import { Subject } from 'rxjs/Subject' ;
4944import { defer } from 'rxjs/observable/defer' ;
5045import { fromEvent } from 'rxjs/observable/fromEvent' ;
5146import { merge } from 'rxjs/observable/merge' ;
5247import { 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' ;
5354import { Subscription } from 'rxjs/Subscription' ;
5455import { MatAutocomplete } from './autocomplete' ;
5556
@@ -68,20 +69,13 @@ export const AUTOCOMPLETE_PANEL_HEIGHT = 256;
6869
6970/** Injection token that determines the scroll handling while the autocomplete panel is open. */
7071export 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+ } ) ;
8579
8680/**
8781 * Provider that allows the autocomplete to register as a ControlValueAccessor.
0 commit comments