@@ -28,15 +28,12 @@ import {
2828 ChangeDetectorRef ,
2929 Directive ,
3030 ElementRef ,
31- Host ,
32- Inject ,
3331 InjectionToken ,
3432 Injector ,
3533 Input ,
3634 NgZone ,
3735 OnChanges ,
3836 OnDestroy ,
39- Optional ,
4037 SimpleChanges ,
4138 ViewContainerRef ,
4239 afterNextRender ,
@@ -134,10 +131,24 @@ export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
134131export class MatAutocompleteTrigger
135132 implements ControlValueAccessor , AfterViewInit , OnChanges , OnDestroy
136133{
134+ private _element = inject < ElementRef < HTMLInputElement > > ( ElementRef ) ;
135+ private _overlay = inject ( Overlay ) ;
136+ private _viewContainerRef = inject ( ViewContainerRef ) ;
137+ private _zone = inject ( NgZone ) ;
138+ private _changeDetectorRef = inject ( ChangeDetectorRef ) ;
139+ private _dir = inject ( Directionality , { optional : true } ) ;
140+ private _formField = inject < MatFormField | null > ( MAT_FORM_FIELD , { optional : true , host : true } ) ;
141+ private _document = inject ( DOCUMENT ) ;
142+ private _viewportRuler = inject ( ViewportRuler ) ;
143+ private _defaults = inject < MatAutocompleteDefaultOptions | null > (
144+ MAT_AUTOCOMPLETE_DEFAULT_OPTIONS ,
145+ { optional : true } ,
146+ ) ;
147+
137148 private _overlayRef : OverlayRef | null ;
138149 private _portal : TemplatePortal ;
139150 private _componentDestroyed = false ;
140- private _scrollStrategy : ( ) => ScrollStrategy ;
151+ private _scrollStrategy = inject ( MAT_AUTOCOMPLETE_SCROLL_STRATEGY ) ;
141152 private _keydownSubscription : Subscription | null ;
142153 private _outsideClickSubscription : Subscription | null ;
143154
@@ -238,23 +249,8 @@ export class MatAutocompleteTrigger
238249
239250 private _injector = inject ( Injector ) ;
240251
241- constructor (
242- private _element : ElementRef < HTMLInputElement > ,
243- private _overlay : Overlay ,
244- private _viewContainerRef : ViewContainerRef ,
245- private _zone : NgZone ,
246- private _changeDetectorRef : ChangeDetectorRef ,
247- @Inject ( MAT_AUTOCOMPLETE_SCROLL_STRATEGY ) scrollStrategy : any ,
248- @Optional ( ) private _dir : Directionality | null ,
249- @Optional ( ) @Inject ( MAT_FORM_FIELD ) @Host ( ) private _formField : MatFormField | null ,
250- @Optional ( ) @Inject ( DOCUMENT ) private _document : any ,
251- private _viewportRuler : ViewportRuler ,
252- @Optional ( )
253- @Inject ( MAT_AUTOCOMPLETE_DEFAULT_OPTIONS )
254- private _defaults ?: MatAutocompleteDefaultOptions | null ,
255- ) {
256- this . _scrollStrategy = scrollStrategy ;
257- }
252+ constructor ( ...args : unknown [ ] ) ;
253+ constructor ( ) { }
258254
259255 /** Class to apply to the panel when it's above the input. */
260256 private _aboveClass = 'mat-mdc-autocomplete-panel-above' ;
0 commit comments