@@ -28,15 +28,12 @@ import {
28
28
ChangeDetectorRef ,
29
29
Directive ,
30
30
ElementRef ,
31
- Host ,
32
- Inject ,
33
31
InjectionToken ,
34
32
Injector ,
35
33
Input ,
36
34
NgZone ,
37
35
OnChanges ,
38
36
OnDestroy ,
39
- Optional ,
40
37
SimpleChanges ,
41
38
ViewContainerRef ,
42
39
afterNextRender ,
@@ -134,10 +131,24 @@ export const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
134
131
export class MatAutocompleteTrigger
135
132
implements ControlValueAccessor , AfterViewInit , OnChanges , OnDestroy
136
133
{
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
+
137
148
private _overlayRef : OverlayRef | null ;
138
149
private _portal : TemplatePortal ;
139
150
private _componentDestroyed = false ;
140
- private _scrollStrategy : ( ) => ScrollStrategy ;
151
+ private _scrollStrategy = inject ( MAT_AUTOCOMPLETE_SCROLL_STRATEGY ) ;
141
152
private _keydownSubscription : Subscription | null ;
142
153
private _outsideClickSubscription : Subscription | null ;
143
154
@@ -238,23 +249,8 @@ export class MatAutocompleteTrigger
238
249
239
250
private _injector = inject ( Injector ) ;
240
251
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 ( ) { }
258
254
259
255
/** Class to apply to the panel when it's above the input. */
260
256
private _aboveClass = 'mat-mdc-autocomplete-panel-above' ;
0 commit comments