Skip to content

Commit

Permalink
refactor(autocomplete): remove 6.0.0 deletion targets (#10319)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
crisbeto authored and jelbourn committed Mar 9, 2018
1 parent be1fc08 commit 0af5bca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
7 changes: 5 additions & 2 deletions src/lib/autocomplete/autocomplete-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {OverlayModule} from '@angular/cdk/overlay';
import {MatOptionModule, MatCommonModule} from '@angular/material/core';
import {MatAutocomplete} from './autocomplete';
import {MatAutocomplete, MAT_AUTOCOMPLETE_DEFAULT_OPTIONS} from './autocomplete';
import {
MatAutocompleteTrigger,
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER,
Expand All @@ -20,6 +20,9 @@ import {
imports: [MatOptionModule, OverlayModule, MatCommonModule, CommonModule],
exports: [MatAutocomplete, MatOptionModule, MatAutocompleteTrigger, MatCommonModule],
declarations: [MatAutocomplete, MatAutocompleteTrigger],
providers: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER],
providers: [
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER,
{provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, useValue: false}
],
})
export class MatAutocompleteModule {}
11 changes: 2 additions & 9 deletions src/lib/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
Output,
InjectionToken,
Inject,
Optional,
} from '@angular/core';
import {
MatOption,
Expand Down Expand Up @@ -150,16 +149,10 @@ export class MatAutocomplete extends _MatAutocompleteMixinBase implements AfterC
constructor(
private _changeDetectorRef: ChangeDetectorRef,
private _elementRef: ElementRef,

// @deletion-target Turn into required param in 6.0.0
@Optional() @Inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS)
defaults?: MatAutocompleteDefaultOptions) {
@Inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS) defaults: MatAutocompleteDefaultOptions) {
super();

this._autoActiveFirstOption = defaults &&
typeof defaults.autoActiveFirstOption !== 'undefined' ?
defaults.autoActiveFirstOption :
false;
this._autoActiveFirstOption = !!defaults.autoActiveFirstOption;
}

ngAfterContentInit() {
Expand Down

0 comments on commit 0af5bca

Please sign in to comment.