Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/material/autocomplete/autocomplete-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,12 @@ export class MatAutocompleteTrigger
{injector: this._environmentInjector},
);
});
const optionChanges = this.autocomplete.options.changes.pipe(
const optionChanges = this.autocomplete.options?.changes.pipe(
tap(() => this._positionStrategy.reapplyLastPosition()),
// Defer emitting to the stream until the next tick, because changing
// bindings in here will cause "changed after checked" errors.
delay(0),
);
) ?? observableOf();

// When the options are initially rendered, and when the option list changes...
return (
Expand Down
2 changes: 1 addition & 1 deletion src/material/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export class MatAutocomplete implements AfterContentInit, OnDestroy {

/** Panel should hide itself when the option list is empty. */
_setVisibility() {
this.showPanel = !!this.options.length;
this.showPanel = !!this.options?.length;
this._changeDetectorRef.markForCheck();
}

Expand Down
Loading