@angular/material 19.2.0-next.0 → 19.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
2
2
  import { AfterContentInit } from '@angular/core';
3
3
  import { AfterViewInit } from '@angular/core';
4
- import { AnimationEvent as AnimationEvent_2 } from '@angular/animations';
5
4
  import { ControlValueAccessor } from '@angular/forms';
6
5
  import { ElementRef } from '@angular/core';
7
6
  import { EventEmitter } from '@angular/core';
@@ -87,9 +86,8 @@ export declare class MatAutocomplete implements AfterContentInit, OnDestroy {
87
86
  private _changeDetectorRef;
88
87
  private _elementRef;
89
88
  protected _defaults: MatAutocompleteDefaultOptions;
89
+ protected _animationsDisabled: boolean;
90
90
  private _activeOptionChanges;
91
- /** Emits when the panel animation is done. Null if the panel doesn't animate. */
92
- _animationDone: EventEmitter<AnimationEvent_2>;
93
91
  /** Manages active item in option list based on key events. */
94
92
  _keyManager: ActiveDescendantKeyManager<MatOption>;
95
93
  /** Whether the autocomplete panel should be visible, depending on option length. */
@@ -248,7 +246,7 @@ export declare class MatAutocompleteSelectedEvent {
248
246
 
249
247
  /** Base class with all of the `MatAutocompleteTrigger` functionality. */
250
248
  export declare class MatAutocompleteTrigger implements ControlValueAccessor, AfterViewInit, OnChanges, OnDestroy {
251
- private _injector;
249
+ private _environmentInjector;
252
250
  private _element;
253
251
  private _overlay;
254
252
  private _viewContainerRef;
@@ -2,7 +2,6 @@ import { AbstractControl } from '@angular/forms';
2
2
  import { AfterContentInit } from '@angular/core';
3
3
  import { AfterViewChecked } from '@angular/core';
4
4
  import { AfterViewInit } from '@angular/core';
5
- import { AnimationEvent as AnimationEvent_2 } from '@angular/animations';
6
5
  import { AnimationTriggerMetadata } from '@angular/animations';
7
6
  import { ChangeDetectorRef } from '@angular/core';
8
7
  import { ComponentType } from '@angular/cdk/portal';
@@ -660,6 +659,8 @@ export declare class MatDatepickerActions implements AfterViewInit, OnDestroy {
660
659
  /**
661
660
  * Animations used by the Material datepicker.
662
661
  * @docs-private
662
+ * @deprecated No longer used, will be removed.
663
+ * @breaking-change 21.0.0
663
664
  */
664
665
  export declare const matDatepickerAnimations: {
665
666
  readonly transformPanel: AnimationTriggerMetadata;
@@ -843,14 +844,18 @@ export declare class MatDatepickerCancel {
843
844
  * future. (e.g. confirmation buttons).
844
845
  * @docs-private
845
846
  */
846
- export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>> implements OnInit, AfterViewInit, OnDestroy {
847
- protected _elementRef: ElementRef<any>;
847
+ export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>> implements AfterViewInit, OnDestroy {
848
+ protected _elementRef: ElementRef<HTMLElement>;
849
+ protected _animationsDisabled: boolean;
848
850
  private _changeDetectorRef;
849
851
  private _globalModel;
850
852
  private _dateAdapter;
853
+ private _ngZone;
851
854
  private _rangeSelectionStrategy;
852
- private _subscriptions;
855
+ private _stateChanges;
853
856
  private _model;
857
+ private _eventCleanups;
858
+ private _animationFallback;
854
859
  /** Reference to the internal calendar component. */
855
860
  _calendar: MatCalendar<D>;
856
861
  /**
@@ -873,8 +878,6 @@ export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>
873
878
  endDateAccessibleName: string | null;
874
879
  /** Whether the datepicker is above or below the input. */
875
880
  _isAbove: boolean;
876
- /** Current state of the animation. */
877
- _animationState: 'enter-dropdown' | 'enter-dialog' | 'void';
878
881
  /** Emits when an animation has finished. */
879
882
  readonly _animationDone: Subject<void>;
880
883
  /** Whether there is an in-progress animation. */
@@ -888,13 +891,12 @@ export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>
888
891
  /** Id of the label for the `role="dialog"` element. */
889
892
  _dialogLabelId: string | null;
890
893
  constructor(...args: unknown[]);
891
- ngOnInit(): void;
892
894
  ngAfterViewInit(): void;
893
895
  ngOnDestroy(): void;
894
896
  _handleUserSelection(event: MatCalendarUserEvent<D | null>): void;
895
897
  _handleUserDragDrop(event: MatCalendarUserEvent<DateRange<D>>): void;
896
898
  _startExitAnimation(): void;
897
- _handleAnimationEvent(event: AnimationEvent_2): void;
899
+ private _handleAnimationEvent;
898
900
  _getSelected(): D | DateRange<D> | null;
899
901
  /** Applies the current pending selection to the global model. */
900
902
  _applyPendingSelection(): void;
@@ -1,12 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, ChangeDetectorRef, ElementRef, EventEmitter, booleanAttribute, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, ContentChildren, Input, Output, Directive, forwardRef, Injector, ViewContainerRef, NgZone, Renderer2, afterNextRender, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, ChangeDetectorRef, ElementRef, ANIMATION_MODULE_TYPE, EventEmitter, booleanAttribute, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, ContentChildren, Input, Output, Directive, forwardRef, EnvironmentInjector, ViewContainerRef, NgZone, Renderer2, afterNextRender, NgModule } from '@angular/core';
3
3
  import { MAT_OPTION_PARENT_COMPONENT, MatOption, MAT_OPTGROUP, MatOptionSelectionChange, _countGroupLabelsBeforeOption, _getOptionScrollPosition, MatOptionModule, MatCommonModule } from '@angular/material/core';
4
4
  export { MatOptgroup, MatOption } from '@angular/material/core';
5
5
  import { ViewportRuler, CdkScrollableModule } from '@angular/cdk/scrolling';
6
6
  import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
7
7
  import { _IdGenerator, ActiveDescendantKeyManager, removeAriaReferencedId, addAriaReferencedId } from '@angular/cdk/a11y';
8
8
  import { Platform, _getEventTarget } from '@angular/cdk/platform';
9
- import { trigger, state, style, transition, group, animate } from '@angular/animations';
10
9
  import { Subscription, Subject, merge, of, defer, Observable } from 'rxjs';
11
10
  import { Directionality } from '@angular/cdk/bidi';
12
11
  import { hasModifierKey, ESCAPE, ENTER, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
@@ -17,22 +16,6 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms';
17
16
  import { MAT_FORM_FIELD } from '@angular/material/form-field';
18
17
  import { filter, map, startWith, switchMap, tap, delay, take } from 'rxjs/operators';
19
18
 
20
- // Animation values come from
21
- // TODO(mmalerba): Ideally find a way to import the values from MDC's code.
22
- const panelAnimation = trigger('panelAnimation', [
23
- state('void, hidden', style({
24
- opacity: 0,
25
- transform: 'scaleY(0.8)',
26
- })),
27
- transition(':enter, hidden => visible', [
28
- group([
29
- animate('0.03s linear', style({ opacity: 1 })),
30
- animate('0.12s cubic-bezier(0, 0, 0.2, 1)', style({ transform: 'scaleY(1)' })),
31
- ]),
32
- ]),
33
- transition(':leave, visible => hidden', [animate('0.075s linear', style({ opacity: 0 }))]),
34
- ]);
35
-
36
19
  /** Event object that is emitted when an autocomplete option is selected. */
37
20
  class MatAutocompleteSelectedEvent {
38
21
  source;
@@ -65,9 +48,8 @@ class MatAutocomplete {
65
48
  _changeDetectorRef = inject(ChangeDetectorRef);
66
49
  _elementRef = inject(ElementRef);
67
50
  _defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS);
51
+ _animationsDisabled = inject(ANIMATION_MODULE_TYPE, { optional: true }) === 'NoopAnimations';
68
52
  _activeOptionChanges = Subscription.EMPTY;
69
- /** Emits when the panel animation is done. Null if the panel doesn't animate. */
70
- _animationDone = new EventEmitter();
71
53
  /** Manages active item in option list based on key events. */
72
54
  _keyManager;
73
55
  /** Whether the autocomplete panel should be visible, depending on option length. */
@@ -192,7 +174,6 @@ class MatAutocomplete {
192
174
  ngOnDestroy() {
193
175
  this._keyManager?.destroy();
194
176
  this._activeOptionChanges.unsubscribe();
195
- this._animationDone.complete();
196
177
  }
197
178
  /**
198
179
  * Sets the panel scrollTop. This allows us to manually scroll to display options
@@ -243,13 +224,13 @@ class MatAutocomplete {
243
224
  return false;
244
225
  }
245
226
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-rc.0", ngImport: i0, type: MatAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
246
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.0-rc.0", type: MatAutocomplete, isStandalone: true, selector: "mat-autocomplete", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], displayWith: "displayWith", autoActiveFirstOption: ["autoActiveFirstOption", "autoActiveFirstOption", booleanAttribute], autoSelectActiveOption: ["autoSelectActiveOption", "autoSelectActiveOption", booleanAttribute], requireSelection: ["requireSelection", "requireSelection", booleanAttribute], panelWidth: "panelWidth", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], classList: ["class", "classList"], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute] }, outputs: { optionSelected: "optionSelected", opened: "opened", closed: "closed", optionActivated: "optionActivated" }, host: { classAttribute: "mat-mdc-autocomplete" }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], queries: [{ propertyName: "options", predicate: MatOption, descendants: true }, { propertyName: "optionGroups", predicate: MAT_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }], exportAs: ["matAutocomplete"], ngImport: i0, template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\"\n (@panelAnimation.done)=\"_animationDone.next($event)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}mat-autocomplete{display:none}"], animations: [panelAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
227
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.0-rc.0", type: MatAutocomplete, isStandalone: true, selector: "mat-autocomplete", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], displayWith: "displayWith", autoActiveFirstOption: ["autoActiveFirstOption", "autoActiveFirstOption", booleanAttribute], autoSelectActiveOption: ["autoSelectActiveOption", "autoSelectActiveOption", booleanAttribute], requireSelection: ["requireSelection", "requireSelection", booleanAttribute], panelWidth: "panelWidth", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], classList: ["class", "classList"], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute] }, outputs: { optionSelected: "optionSelected", opened: "opened", closed: "closed", optionActivated: "optionActivated" }, host: { classAttribute: "mat-mdc-autocomplete" }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], queries: [{ propertyName: "options", predicate: MatOption, descendants: true }, { propertyName: "optionGroups", predicate: MAT_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }], exportAs: ["matAutocomplete"], ngImport: i0, template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-autocomplete-panel-animations-enabled]=\"!_animationsDisabled\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
247
228
  }
248
229
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ngImport: i0, type: MatAutocomplete, decorators: [{
249
230
  type: Component,
250
231
  args: [{ selector: 'mat-autocomplete', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'matAutocomplete', host: {
251
232
  'class': 'mat-mdc-autocomplete',
252
- }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], animations: [panelAnimation], template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\"\n (@panelAnimation.done)=\"_animationDone.next($event)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}mat-autocomplete{display:none}"] }]
233
+ }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-autocomplete-panel-animations-enabled]=\"!_animationsDisabled\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}"] }]
253
234
  }], ctorParameters: () => [], propDecorators: { template: [{
254
235
  type: ViewChild,
255
236
  args: [TemplateRef, { static: true }]
@@ -356,7 +337,7 @@ const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
356
337
  };
357
338
  /** Base class with all of the `MatAutocompleteTrigger` functionality. */
358
339
  class MatAutocompleteTrigger {
359
- _injector = inject(Injector);
340
+ _environmentInjector = inject(EnvironmentInjector);
360
341
  _element = inject(ElementRef);
361
342
  _overlay = inject(Overlay);
362
343
  _viewContainerRef = inject(ViewContainerRef);
@@ -745,7 +726,7 @@ class MatAutocompleteTrigger {
745
726
  const initialRender = new Observable(subscriber => {
746
727
  afterNextRender(() => {
747
728
  subscriber.next();
748
- }, { injector: this._injector });
729
+ }, { injector: this._environmentInjector });
749
730
  });
750
731
  const optionChanges = this.autocomplete.options.changes.pipe(tap(() => this._positionStrategy.reapplyLastPosition()),
751
732
  // Defer emitting to the stream until the next tick, because changing
@@ -851,14 +832,7 @@ class MatAutocompleteTrigger {
851
832
  this._element.nativeElement.value !== this._valueOnAttach) {
852
833
  this._clearPreviousSelectedOption(null);
853
834
  this._assignOptionValue(null);
854
- // Wait for the animation to finish before clearing the form control value, otherwise
855
- // the options might change while the animation is running which looks glitchy.
856
- if (panel._animationDone) {
857
- panel._animationDone.pipe(take(1)).subscribe(() => this._onChange(null));
858
- }
859
- else {
860
- this._onChange(null);
861
- }
835
+ this._onChange(null);
862
836
  }
863
837
  this.closePanel();
864
838
  }