Skip to content

Commit 0af5bca

Browse files
crisbetojelbourn
authored andcommitted
refactor(autocomplete): remove 6.0.0 deletion targets (#10319)
Removes the deletion targets for 6.0.0 in the `material/autocomplete` module. BREAKING CHANGES: * The `defaults` parameter in the `MatAutocomplete` constructor is now required.
1 parent be1fc08 commit 0af5bca

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/lib/autocomplete/autocomplete-module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {NgModule} from '@angular/core';
1010
import {CommonModule} from '@angular/common';
1111
import {OverlayModule} from '@angular/cdk/overlay';
1212
import {MatOptionModule, MatCommonModule} from '@angular/material/core';
13-
import {MatAutocomplete} from './autocomplete';
13+
import {MatAutocomplete, MAT_AUTOCOMPLETE_DEFAULT_OPTIONS} from './autocomplete';
1414
import {
1515
MatAutocompleteTrigger,
1616
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER,
@@ -20,6 +20,9 @@ import {
2020
imports: [MatOptionModule, OverlayModule, MatCommonModule, CommonModule],
2121
exports: [MatAutocomplete, MatOptionModule, MatAutocompleteTrigger, MatCommonModule],
2222
declarations: [MatAutocomplete, MatAutocompleteTrigger],
23-
providers: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER],
23+
providers: [
24+
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER,
25+
{provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, useValue: false}
26+
],
2427
})
2528
export class MatAutocompleteModule {}

src/lib/autocomplete/autocomplete.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
Output,
2222
InjectionToken,
2323
Inject,
24-
Optional,
2524
} from '@angular/core';
2625
import {
2726
MatOption,
@@ -150,16 +149,10 @@ export class MatAutocomplete extends _MatAutocompleteMixinBase implements AfterC
150149
constructor(
151150
private _changeDetectorRef: ChangeDetectorRef,
152151
private _elementRef: ElementRef,
153-
154-
// @deletion-target Turn into required param in 6.0.0
155-
@Optional() @Inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS)
156-
defaults?: MatAutocompleteDefaultOptions) {
152+
@Inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS) defaults: MatAutocompleteDefaultOptions) {
157153
super();
158154

159-
this._autoActiveFirstOption = defaults &&
160-
typeof defaults.autoActiveFirstOption !== 'undefined' ?
161-
defaults.autoActiveFirstOption :
162-
false;
155+
this._autoActiveFirstOption = !!defaults.autoActiveFirstOption;
163156
}
164157

165158
ngAfterContentInit() {

0 commit comments

Comments
 (0)