Can't bind to 'isOpen' since it isn't a known property of 'mat-autocomplete'

Issue

First example from the 13.3.5. Autocomplete docs:

<form class="example-form">
  <mat-form-field class="example-full-width" appearance="fill">
    <mat-label>Number</mat-label>
    <input
      type="text"
      placeholder="Pick one"
      aria-label="Number"
      matInput
      [formControl]="myControl"
      [matAutocomplete]="auto"
    />
    <mat-autocomplete
      autoActiveFirstOption
      #auto="matAutocomplete"
      [isOpen]="true"
    >
      <mat-option
        *ngFor="let option of filteredOptions | async"
        [value]="option"
      >
        {{option}}
      </mat-option>
    </mat-autocomplete>
  </mat-form-field>
</form>

The API documentation states that I can pass isOpen to <mat-autocomplete> to control whether the autocomplete panel is open. If passed simply as isOpen="true" it does nothing, if passed as [isOpen]="true" it reports the above error. Am I not able to pass properties mentioned in the docs? Or am I doing something wrong?

Solution

It’s not something you pass in, that’s a flag for if it’s opened or not that you can use if you need it. It’s not part of the @Input() section.

Answered By – Mathew Berg

Answer Checked By – Mildred Charles (AngularFixing Admin)

Leave a Reply

Your email address will not be published.